diff options
Diffstat (limited to 'bpmn')
216 files changed, 6368 insertions, 4519 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index c85bcd7522..934aea8241 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -397,5 +397,11 @@ <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.11.1</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 8cc232c2a4..8a8e41247c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -19,6 +19,9 @@ */ package org.onap.so.bpmn.common.scripts + +import org.onap.so.client.HttpClientFactory + import java.util.regex.Matcher import java.util.regex.Pattern @@ -88,7 +91,7 @@ class AaiUtil { String regionId = "" try{ URL Url = new URL(url) - HttpClient client = new HttpClient(Url, MediaType.APPLICATION_XML, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index f1eab6601b..df0dfaee60 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -20,29 +20,22 @@ package org.onap.so.bpmn.common.scripts -import org.json.JSONObject; -import org.json.JSONArray; -import org.json.XML +import org.apache.commons.lang3.StringUtils +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject import org.onap.logging.ref.slf4j.ONAPLogConstants -import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.springframework.web.util.UriUtils; - +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import groovy.json.JsonBuilder -import groovy.json.JsonSlurper -import groovy.util.slurpersupport.GPathResult -import groovy.xml.QName; +import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.utils.TargetEntity +import org.springframework.web.util.UriUtils import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response -import org.camunda.bpm.engine.delegate.DelegateExecution - -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.TargetEntity -import org.onap.so.logger.MessageEnum - - /*** * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information @@ -52,415 +45,15 @@ import org.onap.so.logger.MessageEnum class CatalogDbUtils { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CatalogDbUtils.class); - - MsoUtils utils = new MsoUtils() - JsonUtils jsonUtils = new JsonUtils() + private HttpClientFactory httpClientFactory + private MsoUtils msoUtils + private JsonUtils jsonUtils static private String defaultDbAdapterVersion = "v2" - public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return networksList - } - - - public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray vnfsList = null - String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - /** - * This method gets a all vnfs for a particular - * service from the catalog database using the - * service model's model name. - * - * @param catalogDbEndpoint - * @param serviceModelModelName - * @return vnfsList * - * - */ - public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion) - } - }catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - return vnfsList + CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) { + this.httpClientFactory = httpClientFactory + this.msoUtils = msoUtils + this.jsonUtils = jsonUtils } public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) { @@ -489,263 +82,6 @@ class CatalogDbUtils { return vnfsList } - /** - * This method gets a single vf module from - * the catalog database using the vf module's - * model name. It returns that vf module as - * a JSONObject - * - * @param catalogDbEndpoint - * @param vfModuleModelName - * @return vfModule - */ - public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) { - JSONObject vfModule = null - String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") - try{ - msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") - } - } - catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vfModule - } - - /** - * This method gets a single vf module from - * the catalog database using the vf module's - * model name. It returns that vf module as - * a JSONObject - * - * @param catalogDbEndpoint - * @param vfModuleModelName - * @param catalogUtilsVersion - * @return vfModules - */ - public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) { - JSONObject vfModule = null - String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") - try{ - msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") - } - } - catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vfModule - } - - - public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray vnfsList = null - String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray() - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getStackTrace()); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - - public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return vnfsList - } - - public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = parseServiceResourcesJson(catalogDbResponse, "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - throw e - } - - return resources - } - public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { JSONObject resources = null String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") @@ -762,27 +98,7 @@ class CatalogDbUtils { } } catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - throw e - } - - return resources - } - - public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = parseServiceResourcesJson(catalogDbResponse, "v1") - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) throw e } @@ -790,23 +106,14 @@ class CatalogDbUtils { } public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) { - String resources = null String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = catalogDbResponse - } - + return getResponseFromCatalogDb(execution, endPoint) } catch (Exception e) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); throw e } - - return resources } public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { @@ -833,27 +140,6 @@ class CatalogDbUtils { return resources } - - public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - //TODO this is wrong - resources = parseServiceResourcesJson(catalogDbResponse) - } - - } - catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - throw e - } - - return resources - } - public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { JSONObject resources = null String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") @@ -878,8 +164,6 @@ class CatalogDbUtils { return resources } - - private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { JSONArray modelInfos = null @@ -1004,58 +288,6 @@ class CatalogDbUtils { return modelInfos } - /** - * This method parses a Vf Module from the - * Vf Modules array - * - * @param catalogDbResponse - * @param arrayName - * @param catalogUtilsVersion - * @return vfModulelJson - */ - private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { - JSONObject vfModulelJson = new JSONObject() - msoLogger.debug("Started Parse Vf Module Json") - try { - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONArray vfModules = responseJson.getJSONArray(arrayName) - if(vfModules != null){ - JSONObject vfModuleInfo = new JSONObject() - for (int i = 0; i < vfModules.length(); i++) { - JSONObject vfModule = vfModules.getJSONObject(i) - JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) - vfModulelJson.put("modelInfo", vfModuleModelInfo) - String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") - vfModulelJson.put("vfModuleType", vfModuleType) - switch(catalogUtilsVersion) { - case "v1": - Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") - if (isBase.intValue() == 1) { - vfModulelJson.put("isBase", "true") - } - else { - vfModulelJson.put("isBase", "false") - } - break - default: - boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") - vfModulelJson.put("isBase", isBase) - break - } - String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") - vfModulelJson.put("vfModuleLabel", vfModuleLabel) - Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") - vfModulelJson.put("initialCount", initialCount.intValue()) - } - } - msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString()) - }catch (Exception e){ - msoLogger.debug("Exception while parsing Vf Modules from Catalog DB Response: " + e.message) - } - - return vfModulelJson - } - private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { JSONArray modelInfos = null @@ -1108,37 +340,9 @@ class CatalogDbUtils { return modelInfos } - //TODO this is wrong - private JSONObject parseServiceResourcesJson (String catalogDbResponse) { - JSONObject serviceResources = new JSONObject() - String catalogUtilsVersion = "v1" - - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") - JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion) - serviceResources.put("vnfs", vnfsArray) - JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion) - serviceResources.put("networks", networksArray) - JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion) - serviceResources.put("allottedResources", allottedResourcesArray) - - String serviceResourcesString = serviceResources.toString() - msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) - - } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); - } - - return serviceResources - } - private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) { JSONObject serviceResources = new JSONObject() JSONObject serviceResourcesObject = new JSONObject() - String serviceResourcesString = "" try { // Create array of jsons @@ -1154,9 +358,7 @@ class CatalogDbUtils { JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion) serviceResources.put("serviceAllottedResources", allottedResourcesArray) serviceResourcesObject.put("serviceResources", serviceResources) - - serviceResourcesString = serviceResourcesObject.toString() - msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString()) } catch (Exception e) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); @@ -1216,19 +418,12 @@ class CatalogDbUtils { String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint def responseData = '' - def bpmnRequestId = UUID.randomUUID().toString() - - URL url = new URL(queryEndpoint) - HttpClient client = new HttpClient(url, MediaType.APPLICATION_JSON, TargetEntity.CATALOG_DB) - client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, bpmnRequestId) + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB) + client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', "BPMN") client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON) String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB") - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAdditionalHeader("Authorization", basicAuthCred) - }else { - client.addAdditionalHeader("Authorization", getBasicDBAuthHeader(execution)) - } + client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution))) msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint) Response response = client.get() @@ -1270,7 +465,7 @@ class CatalogDbUtils { } } catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) throw e } @@ -1282,13 +477,13 @@ class CatalogDbUtils { String encodedString = null try { String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) - utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) + msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) - encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValueDB",encodedString) } catch (IOException ex) { String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() - utils.log("ERROR", dataErrorMessage) + msoUtils.log("ERROR", dataErrorMessage) } return encodedString } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy new file mode 100644 index 0000000000..faa0037169 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 NOKIA. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClientFactory + +public class CatalogDbUtilsFactory { + + CatalogDbUtils create() { + return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils()) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index c309c3bb68..f4e7926c8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -19,6 +21,11 @@ */ package org.onap.so.bpmn.common.scripts + +import joptsimple.internal.Strings +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.springframework.http.HttpStatus + import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.DelegateExecution @@ -33,8 +40,12 @@ import org.onap.so.logger.MsoLogger public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class); - def Prefix="CVGN_" - ExceptionUtil exceptionUtil = new ExceptionUtil() + def static final Prefix = "CVGN_" + private final ExceptionUtil exceptionUtil + + ConfirmVolumeGroupName(ExceptionUtil exceptionUtil) { + this.exceptionUtil = exceptionUtil + } public void initProcessVariables(DelegateExecution execution) { execution.setVariable("prefix",Prefix) @@ -74,40 +85,39 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ try { Optional<VolumeGroup> volumeGroupOp = getAAIClient().get(VolumeGroup.class, resourceUri) if(volumeGroupOp.isPresent()){ - execution.setVariable("CVGN_queryVolumeGroupResponseCode", 200) + execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.OK.value()) execution.setVariable("CVGN_queryVolumeGroupResponse", volumeGroupOp.get()) }else{ - execution.setVariable("CVGN_queryVolumeGroupResponseCode", 404) + execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.NOT_FOUND.value()) execution.setVariable("CVGN_queryVolumeGroupResponse", "Volume Group not Found!") } } catch (Exception ex) { msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) - execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500) + execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.INTERNAL_SERVER_ERROR.value()) execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed") + exceptionUtil.buildAndThrowWorkflowException(execution, HttpStatus.INTERNAL_SERVER_ERROR.value(), "AAI GET Failed") } } // process the result from queryAAIVolumeGroupId() public void checkAAIQueryResult(DelegateExecution execution) { - def result = execution.getVariable("CVGN_queryVolumeGroupResponse") - def actualVolumeGroupName = "" - if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { + if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.NOT_FOUND.value()) { msoLogger.debug('volumeGroupId does not exist in AAI') } - else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) { + else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.OK.value()) { VolumeGroup volumeGroup = execution.getVariable("CVGN_queryVolumeGroupResponse") - if(volumeGroup.getVolumeGroupName()!=null){ + + if (!Strings.isNullOrEmpty(volumeGroup.getVolumeGroupName())) { actualVolumeGroupName = volumeGroup.getVolumeGroupName() - } - msoLogger.debug("volumeGroupId exists in AAI") + msoLogger.debug("volumeGroupId exists in AAI") + } } execution.setVariable("CVGN_volumeGroupNameMatches", false) def volumeGroupName = execution.getVariable("CVGN_volumeGroupName") - if (volumeGroupName.equals(actualVolumeGroupName)) { + if (!actualVolumeGroupName.isEmpty() && volumeGroupName.equals(actualVolumeGroupName)) { msoLogger.debug('Volume Group Name Matches AAI records') execution.setVariable("CVGN_volumeGroupNameMatches", true) } @@ -121,8 +131,8 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the volume group name does not match AAI record for this volume group public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { - def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") + - " is not associated with " + execution.getVariable("CVGN_volumeGroupName") + def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " + + "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}" msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameFactory.groovy index b7582922b1..f032d640d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameFactory.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. * ================================================================================ * 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. @@ -18,25 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.client.restproperties; +package org.onap.so.bpmn.common.scripts -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName +import org.onap.so.bpmn.common.scripts.ExceptionUtil -@Service -public class AaiPropertiesConfiguration { +public class ConfirmVolumeGroupNameFactory { - @Value("${aai.endpoint}") - private String endpoint; - - @Value("${aai.auth}") - private String auth; - - public String getEndpoint() { - return endpoint; - } - - public String getAuth() { - return auth; - } + ConfirmVolumeGroupName create() { + return new ConfirmVolumeGroupName(new ExceptionUtil()); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy index 739bc4b7ed..1c1d5eb0e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy @@ -20,9 +20,6 @@ package org.onap.so.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; @@ -56,7 +53,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor { String Prefix="DDS_" ExceptionUtil exceptionUtil = new ExceptionUtil() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() JsonUtils jsonUtils = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index 4b701e6a58..e132b411a5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -293,7 +293,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { execution.setVariable("WorkflowException", exception); msoLogger.debug("Outgoing WorkflowException is " + exception) msoLogger.debug("Throwing MSOWorkflowException") - throw new BpmnError("MSOWorkflowException") + throw new BpmnError(errorCode.toString(), String.format("MSOWorkflowException: %s", errorMessage)) } /** diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 5c935e9081..94c82f5a0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -19,29 +19,30 @@ */ package org.onap.so.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.BpmnError + + import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.logging.ref.slf4j.ONAPLogConstants import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.logger.MsoLogger -import org.apache.commons.lang3.StringEscapeUtils -import java.util.regex.Matcher -import java.util.regex.Pattern +import org.onap.so.utils.TargetEntity import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response -import org.onap.so.utils.TargetEntity +import java.util.regex.Matcher +import java.util.regex.Pattern class ExternalAPIUtil { String Prefix="EXTAPI_" - public MsoUtils utils = new MsoUtils() - - ExceptionUtil exceptionUtil = new ExceptionUtil() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) + private final HttpClientFactory httpClientFactory; + private final MsoUtils utils; + private final ExceptionUtil exceptionUtil; + public static final String PostServiceOrderRequestsTemplate = "{\n" + "\t\"externalId\": <externalId>,\n" + @@ -85,7 +86,10 @@ class ExternalAPIUtil { "\t} \n" + "}" - public ExternalAPIUtil() { + ExternalAPIUtil(HttpClientFactory httpClientFactory, MsoUtils utils, ExceptionUtil exceptionUtil) { + this.httpClientFactory = httpClientFactory + this.utils = utils + this.exceptionUtil = exceptionUtil } // public String getUri(DelegateExecution execution, resourceName) { @@ -137,8 +141,7 @@ class ExternalAPIUtil { msoLogger.debug( "Generated uuid is: " + uuid) msoLogger.debug( "URL to be used is: " + url) - URL Url = new URL(url) - HttpClient client = new HttpClient(Url, MediaType.APPLICATION_JSON, TargetEntity.EXTERNAL) + HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL) client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid) @@ -166,17 +169,15 @@ class ExternalAPIUtil { * @return Response * */ - public Response executeExternalAPIPostCall(DelegateExecution execution, String urlString, String payload){ + public Response executeExternalAPIPostCall(DelegateExecution execution, String url, String payload){ msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ") Response apiResponse = null try{ String uuid = utils.getRequestID() msoLogger.debug( "Generated uuid is: " + uuid) - msoLogger.debug( "URL to be used is: " + urlString) - - URL url = new URL(urlString); + msoLogger.debug( "URL to be used is: " + url) - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.AAI) + HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") httpClient.addAdditionalHeader("X-TransactionId", uuid) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy new file mode 100644 index 0000000000..e7f46464ee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.scripts + +import org.onap.so.client.HttpClientFactory + +class ExternalAPIUtilFactory { + + ExternalAPIUtil create() { + return new ExternalAPIUtil(new HttpClientFactory(), new MsoUtils(), new ExceptionUtil()) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index c961dd06eb..1be24c4ce0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.HttpClientFactory import java.io.Serializable; @@ -86,7 +87,8 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ msoLogger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', 'application/xml') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index f9ddd0d430..2f240fb70d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -287,14 +287,6 @@ class MsoUtils { return null } } - def getRelationshipVal(node, name){ - try{ - return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text() - }catch(Exception e){ - return null - } - } - def log(logmode,logtxt,isDebugLogEnabled="false"){ if ("INFO"==logmode) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy index 27d067dfc1..23231df6be 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy @@ -22,11 +22,12 @@ package org.onap.so.bpmn.common.scripts import groovy.xml.XmlUtil import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.HostRoute import org.onap.aai.domain.yang.L3Network +import org.onap.aai.domain.yang.SegmentationAssignment import org.onap.aai.domain.yang.Subnet import org.onap.aai.domain.yang.Subnets import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MsoLogger import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -44,8 +45,6 @@ import javax.xml.transform.stream.StreamResult * This groovy class supports the any Network processes that need the methods defined here. */ class NetworkUtils { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkUtils.class); - public MsoUtils utils = new MsoUtils() private AbstractServiceTaskProcessor taskProcessor @@ -283,187 +282,6 @@ class NetworkUtils { } /** - * This method returns the string for Create Volume Request payload - * @param groupId the volume-group-id - * @param volumeName the volume-group-name - * @param vnfType the vnf-type - * @param tenantId the value of relationship-key 'tenant.tenant-id' - * @return String request payload - */ - def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) { - - String requestPayload = - """<volume-group xmlns="http://org.onap.so/v6"> - <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> - <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> - <heat-stack-id></heat-stack-id> - <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> - <orchestration-status>Pending</orchestration-status> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(tenantId)}</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </volume-group>""" - - return requestPayload - } - - /** - * This method returns the string for Update Volume Request payload - * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) - * @param heatStackId the value of heat stack id - * @return String request payload - */ - def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) { - String requestPayload = "" - if (requeryAAIVolGrpNameResponse != null) { - def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") - def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") - def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") - def relationshipList = "" - if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { - relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) - } - - requestPayload = - """<volume-group xmlns="${namespace}"> - <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> - <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> - <heat-stack-id>${MsoUtils.xmlEscape(heatStackId)}</heat-stack-id> - <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> - <orchestration-status>Active</orchestration-status> - <resource-version>${MsoUtils.xmlEscape(resourceVersion)}</resource-version> - <vf-module-model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</vf-module-model-customization-id> - ${relationshipList} - </volume-group>""" - } - - return requestPayload - } - - - /** - * This method returns the string for Update Volume Request payload - * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) - * @param heatStackId the value of heat stack id - * @return String request payload - */ - def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) { - String requestPayload = "" - if (requeryAAIVolGrpNameResponse != null) { - def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") - def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") - def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") - def relationshipList = "" - if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { - relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) - } - - requestPayload = - """<volume-group xmlns="http://org.onap.so/v6"> - <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> - <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> - <heat-stack-id>${MsoUtils.xmlEscape(heatStackId)}</heat-stack-id> - <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> - <orchestration-status>Active</orchestration-status> - <resource-version>${MsoUtils.xmlEscape(resourceVersion)}</resource-version> - ${relationshipList} - </volume-group>""" - } - - return requestPayload - } - - /** - * This method returns the string for Create Contrail Network payload - * @param requeryIdAAIResponse the response from AAI query by id - * @param createNetworkResponse the response of create network - * @return String contrailNetworkCreatedUpdate - */ - def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) { - - String contrailNetworkCreatedUpdate = "" - if(requeryIdAAIResponse!=null && createNetworkResponse!=null) { - - def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","") - def createNetworkContrailResponse = "" - if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) { - createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","") - } else { - createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","") - } - - // rebuild network - def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn", - "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"] - String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) - - // rebuild 'subnets' - def rebuildSubnetList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) { - rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse) - } - - // rebuild 'segmentation-assignments' - def rebuildSegmentationAssignments = "" - if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) { - List elementList = ["segmentation-id", "resource-version"] - if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignment')) { // new tag - rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "segmentation-assignments", "segmentation-assignment", elementList) - } else { - rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList) - } - } - - // rebuild 'ctag-assignments' / rebuildCtagAssignments - def rebuildCtagAssignmentsList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) { - rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse) - } - - // rebuild 'relationship' - def relationshipList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) { - String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","") - if (utils.nodeExists(rootRelationshipData, 'relationship')) { - relationshipList = rebuildRelationship(rootRelationshipData) - } - } - - //Check for optional contrail network fqdn within CreateNetworkResponse - String contrailNetworkFQDN - if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){ - contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn") - contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN) - contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN) - }else{ - contrailNetworkFQDN = "" - } - - contrailNetworkCreatedUpdate = - """<l3-network xmlns="${schemaVersion}"> - ${rebuildNetworkElements} - ${rebuildSubnetList} - ${rebuildSegmentationAssignments} - ${rebuildCtagAssignmentsList} - ${relationshipList} - ${contrailNetworkFQDN} - </l3-network>""".trim() - - } - return contrailNetworkCreatedUpdate - } - - - - /** * This method returns the value for the name paramName. * Ex: <network-params> * <param name="shared">1</param> @@ -488,34 +306,6 @@ class NetworkUtils { } /** - * This method returns the name of param if found/match with paramName. - * Ex: <network-params> - * <param name="shared">1</param> - * <param name="external">0</external> - * </network-params> - * - * @param xmlInput the XML document - * @param paramName the param name (ex: 'shared', ) - * @return a param name for 'shared' (ex: 'shared' if found) - */ - def getParameterName(xmlInput, paramName) { - def rtn="" - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - try { - rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name' - } catch (Exception ex) { - rtn="" - } - } - if (rtn==null || rtn=="") { - return "" - } else { - return rtn - } - } - - /** * This method returns the networkParams xml string. * Ex: input: * <network-params> @@ -553,222 +343,8 @@ class NetworkUtils { return build } - def getVlans(xmlInput) { - def rtn = "" - if (xmlInput!=null) { - def vlansList = getListWithElements(xmlInput, 'vlans') - def vlansListSize = vlansList.size() - if (vlansListSize > 0) { - for (i in 0..vlansListSize-1) { - rtn += '<vlans>'+vlansList[i]+'</vlans>' - } - } - } - return rtn - - - } - - /** - * This method returns the uri value for the vpn bindings. - * Return the a list of value of vpn binding in the <related-link> string. - * Ex. - * <relationship-list> - * <relationship> - * <related-to>vpn-binding</related-to> - * <related-link>https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - * <relationship-data> - * <relationship-key>vpn-binding.vpn-id</relationship-key> - * <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - * </relationship-data> - * </relationship> - * <relationship> - * <related-to>vpn-binding</related-to> - * <related-link>https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> - * <relationship-data> - * <relationship-key>vpn-binding.vpn-id</relationship-key> - * <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> - * </relationship-data> - * <related-to-property> - * <property-key>vpn-binding.vpn-name</property-key> - * <property-value>oam_protected_net_6_MTN5_msotest1</property-value> - * </related-to-property> - * </relationship> - * @param xmlInput the XML document - * @return a list of vpn binding values - * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/'] - * - **/ - def getVnfBindingObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - /** - * similar to VNF bindings method - * @param xmlInput the XML document - * @return a list of network policy values - * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg'] - * - **/ - def getNetworkPolicyObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of network policy values - * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2'] - * - **/ - def getNetworkTableRefObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of IDs for related VNF instances - * - **/ - def getRelatedVnfIdList(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) { - rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1)) - } else { - rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length())) - } - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of IDs for related Network instances - * - **/ - def getRelatedNetworkIdList(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) { - rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1)) - } else { - rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length())) - } - } - } - } - } - } - return rtn - } - - - def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) { - Boolean rtn = false - try { - String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions")) - String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances")) - if (globalSubscriberIdLink == globalSubscriberId) { - rtn = true - } else { - if (serviceTypeLink == serviceType) { - rtn = true - } - } - - } catch (Exception ex) { - println 'Exception - ' + ex.getMessage() - return false - } - return rtn - } - - def getListWithElements(xmlInput, groupName) { - def rtn = "" - if (xmlInput != null) { - def relationshipData = new XmlSlurper().parseText(xmlInput) - rtn = relationshipData.'**'.findAll {it.name() == groupName} - } - return rtn - - } - // build network single elements + @Deprecated //TODO remove if not used anywhere def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) { def replaceNetworkId = "" def replaceNeutronNetworkId = "" @@ -845,40 +421,6 @@ class NetworkUtils { return xmlNetwork } - def buildSubnets(requeryIdAAIResponse, createNetworkResponse) { - def rebuildingSubnets = "" - if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) { - def subnetIdMapValue = "" - def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false) - def subnetsData = new XmlSlurper().parseText(subnetsGroup) - rebuildingSubnets += "<subnets>" - try { - def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} - def subnetsSize = subnets.size() - for (i in 0..subnetsSize-1) { - def subnet = subnets[i] - def subnetXml = XmlUtil.serialize(subnet) - def orchestrationStatus = utils.getNodeText(subnetXml, "orchestration-status") - if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") { - // skip, do not include in processing, remove!!! - } else { - def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "subnet-role", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"] - rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet") - } - } - if (utils.nodeExists(subnetsData, 'relationship')) { - rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse) - } - - } catch (Exception ex) { - // error - } finally { - rebuildingSubnets += "</subnets>" - } - } - return rebuildingSubnets - } - def buildSubnets(L3Network network) { def rebuildingSubnets = "" Subnets subnets = network.getSubnets() @@ -901,57 +443,6 @@ class NetworkUtils { return rebuildingSubnets } - - // build subnet sub-network single elements - def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) { - String var = "" - def xmlBuild = "" - if (parentName != "") { - xmlBuild += "<"+parentName+">" - } - if (subnetXml != null) { - for (element in elementList) { - def xml= new XmlSlurper().parseText(subnetXml) - var = xml.'**'.find {it.name() == element} - if (var != null) { - if (element=="orchestration-status") { - if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { - xmlBuild += "<"+element+">"+"Created"+"</"+element+">" - } else { // pending-update or PendingUpdate' - xmlBuild += "<"+element+">"+"Active"+"</"+element+">" - } - } else { // "subnet-id", "neutron-subnet-id" - if (element=="subnet-id") { - if (utils.nodeExists(createNetworkResponse, "subnetMap")) { - xmlBuild += "<"+element+">"+var.toString()+"</"+element+">" - String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString()) - xmlBuild += "<neutron-subnet-id>"+neutronSubnetId+"</neutron-subnet-id>" - } - } else { - if (element=="neutron-subnet-id") { - // skip - } else { - if (element=="host-routes") { - if (subnetXml.contains("host-routes")) { - List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] - xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute) - } - } else { - xmlBuild += "<"+element+">"+var.toString()+"</"+element+">" - } - } - } - } - } - } - - } - if (parentName != "") { - xmlBuild += "</"+parentName+">" - } - return xmlBuild - } - // build subnet sub-network single elements def buildSubNetworkElements(Subnet subnet, elementList, parentName) { @@ -986,7 +477,7 @@ class NetworkUtils { networkStartAddress = subnet.getNetworkStartAddress() } if (element == "cidr-mask") { - xmlBuild += "<cidr>"+networkStartAddress+"/"+var+"</cidr>" + xmlBuild += "<cidr>"+networkStartAddress+"/"+ subnet.getCidrMask() +"</cidr>" } } if (element == "dhcp-enabled") { @@ -1025,236 +516,40 @@ class NetworkUtils { } // rebuild host-routes - def buildHostRoutes(subnetXml) { - List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] - def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList) + def buildHostRoutes(Subnet subnet) { def buildHostRoutes = "" - def var = "" - if (hostRoutes!=null) { - def routesData = new XmlSlurper().parseText(hostRoutes) - def routes = routesData.'**'.findAll {it.name() == "host-route"} - def routesSize = routes.size() - for (i in 0..routesSize-1) { - buildHostRoutes += "<hostRoutes>" - def route = routes[i] - def routeXml = XmlUtil.serialize(route) - List elementList = ["route-prefix", "next-hop"] - for (element in elementList) { - def xml= new XmlSlurper().parseText(routeXml) - var = xml.'**'.find {it.name() == element} - if (element == "route-prefix") { - buildHostRoutes += "<prefix>"+var.toString()+"</prefix>" - } - if (element == "next-hop") { - buildHostRoutes += "<nextHop>"+var.toString()+"</nextHop>" - } - } - buildHostRoutes += "</hostRoutes>" + List<HostRoute> routes = subnet.getHostRoutes().getHostRoute() + if(!routes.isEmpty()){ + for(HostRoute route:routes){ + buildHostRoutes += "<hostRoutes>" + buildHostRoutes += "<prefix>" + route.getRoutePrefix() + "</prefix>" + buildHostRoutes += "<nextHop>" + route.getNextHop() + "</nextHop>" + buildHostRoutes += "</hostRoutes>" } } - return buildHostRoutes + return buildHostRoutes } - // rebuild ctag-assignments - def rebuildCtagAssignments(xmlInput) { - def rebuildingCtagAssignments = "" - if (xmlInput!=null) { - def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput) - rebuildingCtagAssignments += "<ctag-assignments>" - def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"} - def ctagAssignmentsSize = ctagAssignments.size() - for (i in 0..ctagAssignmentsSize-1) { - def ctagAssignment = ctagAssignments[i] - def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment) - rebuildingCtagAssignments += "<ctag-assignment>" - List elementList = ["vlan-id-inner", "resource-version"] - rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList) - if (utils.nodeExists(ctagAssignmentXml, 'relationship')) { - rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml) + private String buildVlans(L3Network queryIdResponse) { // get seg ids in put in vlan tags + String vlans = "<vlans>" + if(queryIdResponse.getSegmentationAssignments() != null){ + List<SegmentationAssignment> segmentations = queryIdResponse.getSegmentationAssignments().getSegmentationAssignment() + if(!segmentations.isEmpty()){ + for(SegmentationAssignment seg:segmentations){ + String vlan = seg.getSegmentationId() + "," + vlans += vlan } - rebuildingCtagAssignments += "</ctag-assignment>" } - rebuildingCtagAssignments += "</ctag-assignments>" } - return rebuildingCtagAssignments - } - // rebuild 'relationship-list' - def rebuildRelationship(xmlInput) { - def rebuildingSubnets = "" - if (xmlInput!=null) { - def subnetsData = new XmlSlurper().parseText(xmlInput) - rebuildingSubnets += "<relationship-list>" - def relationships = subnetsData.'**'.findAll {it.name() == "relationship"} - def relationshipsSize = relationships.size() - for (i in 0..relationshipsSize-1) { - def relationship = relationships[i] - def relationshipXml = XmlUtil.serialize(relationship) - rebuildingSubnets += "<relationship>" - def relationshipList = ["related-to", "related-link"] - rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "") - if (utils.nodeExists(relationshipXml, 'relationship-data')) { - def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) - def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"} - def relationshipsDataSize = relationshipsData.size() - for (j in 0..relationshipsDataSize-1) { - def relationshipData = relationshipsData[j] - def relationshipDataXml = XmlUtil.serialize(relationshipData) - def relationshipDataList = ["relationship-key", "relationship-value"] - rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList) - } - } - if (utils.nodeExists(relationshipXml, 'related-to-property')) { - def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) - def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"} - def relationshipsDataSize = relationshipsData.size() - for (j in 0..relationshipsDataSize-1) { - def relationshipData = relationshipsData[j] - def relationshipDataXml = XmlUtil.serialize(relationshipData) - def relationshipDataList = ["property-key", "property-value"] - rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList) - } - } - - rebuildingSubnets += "</relationship>" - } - rebuildingSubnets += "</relationship-list>" + if(vlans.endsWith(",")){ + vlans = vlans.substring(0, vlans.length() - 1) } - return rebuildingSubnets - } - - def buildVlans(queryIdResponse) { - def rebuildingSubnets = "<vlans>" - def subnetsData = new XmlSlurper().parseText(queryIdResponse) - - try { - def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"} - def subnetsSize = subnets.size() - for (i in 0..subnetsSize-1) { - def subnet = subnets[i] - def subnetXml = XmlUtil.serialize(subnet) - - String vlan = utils.getNodeText(subnetXml, "segmentation-id") - if (i>0){ - rebuildingSubnets += "," - } - rebuildingSubnets += vlan - } - } catch (Exception ex) { - // - } finally { - //rebuildingSubnets += "</subnets>" - rebuildingSubnets += "</vlans>" - } - return rebuildingSubnets - } - /* Utility code to rebuild xml/elements in a list: - * rebuild xml with 1) unbounded groups of elements; or - * 2) one group of elements; or - * 3) just one or more elements (in a list as argument) - * @param xmlInput the XML document - * @param parentName the parent name (ex: 'inputs') - * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1) - * @param elementList the element list of children (ex: 'key', 'value') - * @return a string of rebuild xml - * - * Ex 1: xmlInput: - * <ws:inputs> - * <ws:entry> - * <ws:key>name</ws:key> - * <ws:value>Edward</ws:value> - * </ws:entry> - * <ws:entry> - * <ws:key>age</ws:key> - * <ws:value>30</ws:value> - * </ws:entry> - * <ws:entry> - * <ws:key>age</ws:key> - * <ws:value>30</ws:value> - * </ws:entry> - * <ws:/inputs> - * Usage: - * List elementList = ["key", "value"] - * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList) - * - * Ex 2: xmlInput // no parent tag - * <ws:sdnc-request-header> - * <ws:svc-request-id>fec8ec88-151a-45c9-ad60-8233e0fc8ff2</ws:svc-request-id> - * <ws:svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</ws:svc-notification-url> - * <ws:svc-action>assign</ws:svc-action> - * </ws:sdnc-request-header> - * Usage: - * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"] - * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag - * - * Ex 3: xmlInput // elements one after another (with no parent & children tag) - * <ws:test-id>myTestid</ws:test-id> - * <ws:test-user>myUser</ws:test-user> - * Usage: - * List elementList = ["test-id", "test-user"] - * String rebuild = buildXMLElements(xmlInput, "" , "", elementList) - * - */ - def buildXMLElements(xmlInput, parentName, childrenName, elementList) { - def varChildren = "" - def var = "" - def xmlBuildUnbounded = "" - if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'} - if (xmlInput != null) { - def xml= new XmlSlurper().parseText(xmlInput) - if (childrenName!="") { - varChildren = xml.'**'.findAll {it.name() == childrenName} - for (i in 0..varChildren.size()-1) { - xmlBuildUnbounded += "<"+childrenName+">" +'\n' - for (element in elementList) { - var = varChildren[i].'*'.find {it.name() == element} - if (var != null) { - xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n' - } - } - xmlBuildUnbounded += "</"+childrenName+">" +'\n' - } - } else { - for (element in elementList) { - var = xml.'*'.find {it.name() == element} - if (var != null) { - xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n' - } - } - } - - } - if (parentName!="") {xmlBuildUnbounded += "</"+parentName+">" +'\n'} - return xmlBuildUnbounded - } - - def getFirstNodeXml(xmlInput, element){ - def nodeAsText = "" - def nodeToSerialize = "" - if (xmlInput != null) { - def fxml= new XmlSlurper().parseText(xmlInput) - if (utils.nodeExists(xmlInput, "payload")) { - nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element} - if (nodeToSerialize!=null) { - nodeAsText = XmlUtil.serialize(nodeToSerialize) - } else { - nodeAsText = "" - } - - } else { - nodeToSerialize = fxml.'*'.find {it.name() == element} - if (nodeToSerialize!=null) { - nodeAsText = XmlUtil.serialize(nodeToSerialize) - } else { - nodeAsText = "" - } - - } - } - return nodeAsText + vlans += "</vlans>" + return vlans } //TODO: This method still needs to be tested before using. diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index ee93f3a445..5659c7affa 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -31,6 +31,7 @@ import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.logger.MsoLogger import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite @@ -159,8 +160,8 @@ class OofHoming extends AbstractServiceTaskProcessor { URL url = new URL(urlString); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SNIRO) - httpClient.addAdditionalHeader("Authorization", authHeader) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) + httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(oofRequest) int responseCode = httpResponse.getStatus() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 46ecc7bbe6..c0da8881fb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -34,6 +34,7 @@ import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.utils.TargetEntity import org.springframework.http.HttpEntity @@ -507,10 +508,10 @@ class OofUtils { String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution) String uri = "/cloudSite" - URL url = new URL(endpoint + uri) - HttpClient client = new HttpClient(url, MediaType.APPLICATION_JSON, TargetEntity.EXTERNAL) - client.addAdditionalHeader(HttpHeaders.AUTHORIZATION, auth) - client.addAdditionalHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) + URL url = new URL(endpoint + uri) + HttpClient client = new HttpClientFactory().newJsonClient(url, TargetEntity.EXTERNAL) + client.addAdditionalHeader(HttpHeaders.AUTHORIZATION, auth) + client.addAdditionalHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) Response response = client.post(request.getBody().toString()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index 8f0e481c9a..15f00ac25f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -223,7 +223,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) client.update(uri, vfModule) - + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 200) // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for // backward compatibilty, the heat-stack-id is an output execution.setVariable('PUAAIVfMod_outVfModule', vfModule) @@ -238,9 +238,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { msoLogger.trace('Exited ' + method) } catch (BpmnError e) { + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500) throw e; } catch (Exception e) { msoLogger.error(e) + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index 852f8d75bd..a430cdb715 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -28,11 +28,10 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - +import static org.apache.commons.lang3.StringUtils.* // SDNC Adapter Request/Response processing - public class SDNCAdapter extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapter.class); @@ -58,6 +57,11 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { execution.setVariable("SDNCA_SuccessIndicator", false) execution.setVariable("SDNCA_InterimNotify", false) + String requestId = execution.getVariable("mso-request-id") + if(isBlank(requestId)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 400, 'mso-request-id not provided by calling flow') + } + // Authorization Info String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) @@ -118,8 +122,8 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { msoLogger.debug("source: " + source) //calling process should pass a generated uuid if sending multiple sdnc requests - def requestId = utils.getNodeText(requestHeader, "RequestId") - execution.setVariable(Prefix + "requestId", requestId) + def sdncRequestId = utils.getNodeText(requestHeader, "RequestId") + execution.setVariable(Prefix + "requestId", sdncRequestId) // Prepare SDNC Request to the SDNC Adapter String sdncAdapterRequest = """ @@ -127,7 +131,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { <SOAP-ENV:Body> <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.onap/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId>""" + <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>""" if (sdnca_svcInstanceId != null) { sdncAdapterRequest += """ @@ -180,7 +184,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { callbackHeader = callbackHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") - + msoLogger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData) execution.setVariable("enhancedCallbackRequestData", callbackRequestData) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index d7fc6ac995..9f1570ee15 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.client.HttpClientFactory + import java.text.SimpleDateFormat import javax.ws.rs.core.Response import java.net.URLEncoder @@ -207,7 +209,10 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SDNC_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER) + httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) + httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) + httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter") httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id")) httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id")) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy index 401cac9820..9556ae7d6a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -34,6 +34,7 @@ import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.utils.TargetEntity import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -133,7 +134,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{ msoLogger.debug("Sniro Url is: " + urlString) URL url = new URL(urlString); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SNIRO) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(sniroRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index 6691a82352..3c4edd21ca 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -174,23 +174,27 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { personaModelVersionEntry = updateVfModuleNode(origRequest, 'persona-model-version') } String contrailServiceInstanceFqdnEntry = updateVfModuleNode(origRequest, 'contrail-service-instance-fqdn') - def payload = """ - { ${orchestrationStatusEntry} - ${heatStackIdEntry} - ${personaModelVersionEntry} - ${contrailServiceInstanceFqdnEntry} - "vf-module-id": "${vfModuleId}" - } - """ + org.onap.aai.domain.yang.VfModule payload = new org.onap.aai.domain.yang.VfModule(); + payload.setVfModuleId(vfModuleId) + payload.setOrchestrationStatus(orchestrationStatusEntry) + payload.setHeatStackId(heatStackIdEntry) + payload.setPersonaModelVersion(personaModelVersionEntry) + payload.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdnEntry) try { AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) getAAIClient().update(resourceUri, payload) + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success") }catch(NotFoundException ignored){ msoLogger.debug("VF-Module not found!!") + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 404) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', ignored.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "vf-module " + vfModuleId + " not found for under vnf " + vnfId + " in A&AI!") } catch(Exception ex){ + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Exception occurred while executing AAI PATCH:' + ex.getMessage()) } } catch (BpmnError e) { @@ -210,87 +214,19 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { private String updateVfModuleNode(String origRequest, String elementName) { if (!utils.nodeExists(origRequest, elementName)) { - return "" + return null } def elementValue = utils.getNodeText(origRequest, elementName) if (elementValue.equals('DELETE')) { - // Set the element being deleted to null - return """"${elementName}": null,""" + // Set the element being deleted to empty string + return "" } else { - return """"${elementName}": "${elementValue}",""" + return elementValue } } - - /** - * Check the Volume Group ID from the incoming update request against the Volume Group ID from the - * given VF Module. If they are equal or if they are both 'null', then that is acceptable and 'null' - * is returned. Otherwise a message describing how the values are unacceptable/incompatible is returned. - * - * @param origRequest Incoming update request with VF Module elements to be updated. - * @param vfModuleNode VF Module (as a Node) retrieved from AAI. - * @param isDebugLogEnabled Is DEBUG log enabled? - * @return 'null' if the Volume Group IDs are acceptable. Otherwise return a message describing how the - * values are unacceptable/incompatible. - */ - private String checkVolumeGroupId(String origRequest, Node vfModuleNode, String isDebugLogEnabled) { - def requestVolumeGroupId = utils.getNodeText(origRequest, 'volume-group-id') - def currVolumeGroupId = getCurrVolumeGroupId(vfModuleNode) - - msoLogger.debug('Check volume-group-id: volume-group-id in original request is \'' + requestVolumeGroupId + '\', volume-group-id from VF Module is \'' + currVolumeGroupId + '\'') - - def result = null - - if (requestVolumeGroupId == null) { - if (currVolumeGroupId == null) { - // This is OK - } else { - result = 'Cannot detach a volume group from an existing VF Module' - } - } else { - if (currVolumeGroupId == null) { - result = 'Cannot add a volume gruop to an existing VF Module' - } else { - if (!requestVolumeGroupId.equals(currVolumeGroupId)) { - result = 'Cannot change the volume group on an existing VF Module' - } - } - } - - return result - } - - /** - * Find and return the value of the Volume Group ID for the specified VF Module. If - * the value of the Volume Group ID cannot be found for any reason, 'null' is returned. - * - * @param vfModuleNode VF Module (as a Node) retrieved from AAI. - * @return the value of the Volume Group ID for the specified VF Module. If the - * value of the Volume Group ID cannot be found for any reason, 'null' is returned. - */ - private String getCurrVolumeGroupId(Node vfModuleNode) { - def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list') - if (relationshipList == null) { - return null - } - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationshipNode in relationships) { - def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to') - if ((relatedTo != null) && relatedTo.equals('volume-group')) { - def NodeList relationshipDataList = utils.getIdenticalChildren(relationshipNode, 'relationship-data') - for (Node relationshipDataNode in relationshipDataList) { - def String relationshipKey = utils.getChildNodeText(relationshipDataNode, 'relationship-key') - if ((relationshipKey != null) && relationshipKey.equals('volume-group.volume-group-id')) { - return utils.getChildNodeText(relationshipDataNode, 'relationship-value') - } - } - } - } - return null - } - /** * Generates a WorkflowException if the AAI query returns a response code other than 200. * diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index fec140da33..c1cd42e893 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -20,16 +20,9 @@ package org.onap.so.bpmn.common.scripts; -import java.io.ObjectInputStream.BlockDataInputStream - -import java.io.ObjectInputStream.BlockDataInputStream - -//import groovy.util.Node; - import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory -import org.apache.commons.lang3.* import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -38,9 +31,6 @@ import org.xml.sax.InputSource import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - - - public abstract class VfModuleBase extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleBase.class); @@ -195,39 +185,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } return entries } - - /** - * Extract the Tenant Id from the Volume Group information returned by AAI. - * - * @param volumeGroupXml Volume Group XML returned by AAI. - * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if - * the Tenant Id is missing or could not otherwise be extracted. - */ - protected String getTenantIdFromVolumeGroup(String volumeGroupXml) { - def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (groovy.util.Node relationship in relationships) { - def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { - def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') - for (groovy.util.Node relationshipData in relationshipDataList) { - def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') - if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { - def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') - if (relationshipValue != null) { - return relationshipValue.text() - } - } - } - } - } - } - return null - } - - + /* * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response * and puts them into the format expected by VNF adapter. diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 13cc7f8d11..78af8768f9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.client.HttpClientFactory + import javax.ws.rs.core.Response import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError @@ -29,6 +31,8 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.TargetEntity +import java.util.UUID + @@ -309,9 +313,12 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(vnfAdapterUrl); - HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) - + + httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) + httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) + httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter") Response response; if ("GET".equals(vnfAdapterMethod)) { @@ -358,16 +365,15 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. execution.setVariable("WorkflowResponse", callback) + callback = utils.removeXmlPreamble(callback) + Node root = new XmlParser().parseText(callback) if (root.name().endsWith('Exception')) { vnfAdapterWorkflowException(execution, callback) } } catch (Exception e) { - e.printStackTrace() - callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback - String msg = "Received error from VnfAdapter: " + callback - msoLogger.debug(getProcessKey(execution) + ': ' + msg) - exceptionUtil.buildWorkflowException(execution, 7020, msg) + msoLogger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e) + exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method") } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 1989ca8cf9..12a4b2a9c3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.resource; import java.io.File; import java.io.IOException; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -45,7 +46,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; -import org.onap.so.logger.MessageEnum; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -259,19 +260,24 @@ public class ResourceRequestBuilder { private static String getCsarFromUuid(String uuid) throws Exception { String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + HttpClient client = new HttpClientFactory().newJsonClient( + UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), + TargetEntity.CATALOG_DB); + client.addAdditionalHeader("Accept", "application/json"); +// client.addBasicAuthHeader (UrnPropertiesReader.getVariable("mso.adapters.db.auth"), UrnPropertiesReader.getVariable("mso.msoKey")); + client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); Response response = client.get(); String value = response.readEntity(String.class); HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); - String filePath = System.getProperty("mso.config.path") + "/ASDC/" + map.get("version") + "/" + map.get("name"); + String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", map.get("version"), map.get("name")).normalize().toString(); File csarFile = new File(filePath); if(!csarFile.exists()) { - throw new Exception("csar file does not exist."); + throw new Exception("csar file does not exist in filePath:" + csarFile.getAbsolutePath()); } return csarFile.getAbsolutePath(); @@ -283,7 +289,7 @@ public class ResourceRequestBuilder { try { return mapper.readValue(jsonstr, type); } catch(IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e); + LOGGER.error("fail to unMarshal json" + e.getMessage ()); } return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 343bd95eaa..781eba3332 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -101,6 +101,8 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { private ModelInfoNetwork modelInfoNetwork; @JsonProperty("aggregate-routes") private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); + @JsonProperty("vpn-binding") + private List<VpnBinding> vpnBindings = new ArrayList<>(); public ModelInfoNetwork getModelInfoNetwork() { return modelInfoNetwork; @@ -261,6 +263,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { return aggregateRoutes; } + public List<VpnBinding> getVpnBindings(){ + return vpnBindings; + } + @Override public boolean equals(final Object other) { if (!(other instanceof L3Network)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java index 4662db23a1..9709ccece0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -30,5 +30,6 @@ public enum ResourceKey { CONFIGURATION_ID, NETWORK_COLLECTION_ID, VPN_ID, - VPN_BONDING_LINK_ID; + VPN_BONDING_LINK_ID, + INSTANCE_GROUP_ID; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java index 1f02fea071..e03ee358f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java @@ -28,7 +28,6 @@ public class ModelInfoInstanceGroup implements Serializable { private static final long serialVersionUID = -8279040393230356226L; public static final String TYPE_L3_NETWORK = "L3-NETWORK"; - public static final String TYPE_NETWORK_INSTANCE_GROUP = "networkInstanceGroup"; public static final String TYPE_VNFC = "VNFC"; @JsonProperty("model-uuid") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 5296d5995f..63f832d706 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -90,6 +90,7 @@ import org.onap.so.serviceinstancebeans.Vnfs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -112,6 +113,9 @@ public class BBInputSetup implements JavaDelegate { @Autowired private BBInputSetupMapperLayer mapperLayer; + + @Autowired + private CloudInfoFromAAI cloudInfoFromAAI; @Autowired private ExceptionBuilder exceptionUtil; @@ -121,6 +125,10 @@ public class BBInputSetup implements JavaDelegate { public BBInputSetupUtils getBbInputSetupUtils() { return bbInputSetupUtils; } + + public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) { + this.cloudInfoFromAAI = cloudInfoFromAAI; + } public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -382,16 +390,10 @@ public class BBInputSetup implements JavaDelegate { ModelInfo vnfModelInfo = new ModelInfo(); vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); this.mapCatalogVnf(tempVnf, vnfModelInfo, service); - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { - for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { - String volumeGroupCustId = - this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(), - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); - if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - break; - } - } + Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo, cloudConfiguration.getCloudOwner(), + cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap); + if(volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); } break; } @@ -420,6 +422,21 @@ public class BBInputSetup implements JavaDelegate { throw new Exception("Could not find relevant information for related VNF"); } } + + protected Optional<String> getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo, + String cloudOwner, String cloudRegionId, Map<ResourceKey, String> lookupKeyMap) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { + for(VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + String volumeGroupCustId = + bbInputSetupUtils.getAAIVolumeGroup(cloudOwner, + cloudRegionId, volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + return Optional.of(volumeGroup.getVolumeGroupId()); + } + } + } + return Optional.empty(); + } protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, String vnfModelCustomizationUUID) { @@ -592,16 +609,27 @@ public class BBInputSetup implements JavaDelegate { vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, generatedVnfType, instanceParams); serviceInstance.getVnfs().add(vnf); + mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); } if(vnf != null) { mapCatalogVnf(vnf, modelInfo, service); - mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); - if (instanceGroupId != null && instanceGroupModelInfo != null) { + if (instanceGroupId != null && instanceGroupModelInfo != null + && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup) + && !instanceGroupInList(vnf, instanceGroupId)) { mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); } } } + protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) { + for(InstanceGroup instanceGroup : vnf.getInstanceGroups()) { + if(instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) { + return true; + } + } + return false; + } + protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); if(vnfResourceCustomization != null) { @@ -609,8 +637,9 @@ public class BBInputSetup implements JavaDelegate { .getVnfcInstanceGroupCustomizations(); for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { InstanceGroup instanceGroup = this.createInstanceGroup(); - instanceGroup.setModelInfoInstanceGroup(this.mapperLayer - .mapCatalogInstanceGroupToInstanceGroup(null, vnfcInstanceGroupCust.getInstanceGroup())); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getModelUUID()); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer + .mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup)); instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); genericVnf.getInstanceGroups().add(instanceGroup); @@ -847,8 +876,13 @@ public class BBInputSetup implements JavaDelegate { String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity, lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); - org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = this.bbInputSetupUtils - .getAAIServiceInstanceById(serviceInstanceId); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if(customer != null && customer.getServiceSubscription() != null) { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType(), serviceInstanceId); + } else { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } if (serviceInstanceAAI != null && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) { Service tempService = this.bbInputSetupUtils @@ -872,8 +906,20 @@ public class BBInputSetup implements JavaDelegate { throws Exception { String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); String key = executeBB.getBuildingBlock().getKey(); + + if (requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration") + || requestAction.equalsIgnoreCase("recreateInstance") + || requestAction.equalsIgnoreCase("replaceInstance")) { + return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction, + requestDetails.getCloudConfiguration()); + } + + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, - resourceId); + serviceInstanceId); RequestParameters requestParams = requestDetails.getRequestParameters(); Service service = null; if (gBB != null && gBB.getServiceInstance() != null @@ -896,16 +942,10 @@ public class BBInputSetup implements JavaDelegate { if (requestAction.equalsIgnoreCase("deactivateInstance")) { return gBB; } else if (requestAction.equalsIgnoreCase("createInstance")) { - return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); - } else if (requestAction.equalsIgnoreCase("deleteInstance") - || requestAction.equalsIgnoreCase("unassignInstance") - || requestAction.equalsIgnoreCase("activateInstance") - || requestAction.equalsIgnoreCase("activateFabricConfiguration")) { - return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, gBB, service, requestAction, - requestDetails.getCloudConfiguration()); + return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); } else { - throw new IllegalArgumentException( - "No user params on requestAction: assignInstance. Please specify user params."); + throw new IllegalArgumentException( + "No user params on requestAction: assignInstance. Please specify user params."); } } @@ -977,14 +1017,40 @@ public class BBInputSetup implements JavaDelegate { } protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, - Map<ResourceKey, String> lookupKeyMap, String bbName, GeneralBuildingBlock gBB, Service service, - String requestAction, CloudConfiguration cloudConfiguration) throws Exception { + Map<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, CloudConfiguration cloudConfiguration) throws Exception { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + RequestDetails requestDetails = executeBB.getRequestDetails(); + GeneralBuildingBlock gBB = null; + if (serviceInstanceId != null) { + aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + Service service = null; + if (aaiServiceInstance != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } + if (aaiServiceInstance != null && service != null) { + ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); + serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); + } else { + msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); + msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + throw new Exception("Could not find relevant information for related Service Instance"); + } ServiceInstance serviceInstance = gBB.getServiceInstance(); - if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) { + CloudRegion cloudRegion = null; + if(cloudConfiguration == null) { + Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + if(cloudRegionOp.isPresent()) { + cloudRegion = cloudRegionOp.get(); + } + } + if (cloudConfiguration != null) { org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); - CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); - gBB.setCloudRegion(cloudRegion); + cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } + gBB.setCloudRegion(cloudRegion); if (bbName.contains(VNF)) { for (GenericVnf genericVnf : serviceInstance.getVnfs()) { if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null @@ -1013,6 +1079,13 @@ public class BBInputSetup implements JavaDelegate { ModelInfo vfModuleModelInfo = new ModelInfo(); vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + if(cloudRegion != null) { + Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), lookupKeyMap); + if(volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); + } + } break; } } @@ -1028,9 +1101,9 @@ public class BBInputSetup implements JavaDelegate { vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); this.mapCatalogVnf(vnf, vnfModelInfo, service); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); - if (cloudConfiguration != null) { - String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(), - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) + if (cloudRegion != null) { + String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) .getModelCustomizationId(); ModelInfo volumeGroupModelInfo = new ModelInfo(); volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID); @@ -1228,7 +1301,12 @@ public class BBInputSetup implements JavaDelegate { .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); } if (serviceInstanceId != null && serviceInstanceAAI == null) { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + if(customer != null && customer.getServiceSubscription() != null) { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType(), serviceInstanceId); + } else { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } } if (serviceInstanceAAI != null) { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java new file mode 100644 index 0000000000..37088022bc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -0,0 +1,93 @@ +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.util.List; +import java.util.Optional; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; + +@Component +public class CloudInfoFromAAI { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudInfoFromAAI.class); + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + protected Optional<CloudRegion> getCloudInfoFromAAI(ServiceInstance serviceInstance) throws JsonProcessingException { + Optional<Relationships> relationshipsOp = Optional.empty(); + if(!serviceInstance.getVnfs().isEmpty()) { + GenericVnf vnf = serviceInstance.getVnfs().get(0); + org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVnf)); + relationshipsOp = getRelationshipsFromWrapper(vnfWrapper); + } else if(!serviceInstance.getNetworks().isEmpty()) { + L3Network network = serviceInstance.getNetworks().get(0); + org.onap.aai.domain.yang.L3Network aaiL3Network = bbInputSetupUtils.getAAIL3Network(network.getNetworkId()); + AAIResultWrapper networkWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network)); + relationshipsOp = getRelationshipsFromWrapper(networkWrapper); + } else { + msoLogger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); + return Optional.empty(); + } + if (relationshipsOp.isPresent()) { + return getRelatedCloudRegionAndTenant(relationshipsOp.get()); + } else { + msoLogger.debug("BBInputSetup could not find a cloud region or tenant"); + return Optional.empty(); + } + } + + protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) { + Optional<Relationships> relationshipsOp; + relationshipsOp = wrapper.getRelationships(); + if(relationshipsOp.isPresent()) { + return relationshipsOp; + } + return Optional.empty(); + } + + protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) { + CloudRegion cloudRegion = new CloudRegion(); + List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION); + List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT); + if(!cloudRegions.isEmpty()) { + AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0); + Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp = cloudRegionWrapper + .asBean(org.onap.aai.domain.yang.CloudRegion.class); + if(aaiCloudRegionOp.isPresent()) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = aaiCloudRegionOp.get(); + cloudRegion.setCloudOwner(aaiCloudRegion.getCloudOwner()); + cloudRegion.setCloudRegionVersion(aaiCloudRegion.getCloudRegionVersion()); + cloudRegion.setLcpCloudRegionId(aaiCloudRegion.getCloudRegionId()); + cloudRegion.setComplex(aaiCloudRegion.getComplexName()); + } + } + if(!tenants.isEmpty()) { + AAIResultWrapper tenantWrapper = tenants.get(0); + Optional<org.onap.aai.domain.yang.Tenant> aaiTenantOp = tenantWrapper + .asBean(org.onap.aai.domain.yang.Tenant.class); + if(aaiTenantOp.isPresent()) { + org.onap.aai.domain.yang.Tenant aaiTenant = aaiTenantOp.get(); + cloudRegion.setTenantId(aaiTenant.getTenantId()); + } + } + return Optional.of(cloudRegion); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index ba9426d88a..6c2df13c61 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -76,43 +76,54 @@ public class ExecuteBuildingBlockRainyDay { Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); String serviceType = ASTERISK; boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); - try { - serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); - } catch (Exception ex) { - // keep default serviceType value - } - String vnfType = ASTERISK; - try { - for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { - if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnfType = vnf.getVnfType(); + boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); + String handlingCode = ""; + if(suppressRollback){ + handlingCode = "Abort"; + }else{ + try { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); + } catch (Exception ex) { + // keep default serviceType value + } + String vnfType = ASTERISK; + try { + for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + } } + } catch (Exception ex) { + // keep default vnfType value } - } catch (Exception ex) { - // keep default vnfType value - } - WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); - String errorCode = ASTERISK; - try { - errorCode = "" + workflowException.getErrorCode(); - } catch (Exception ex) { - // keep default errorCode value - } - String workStep = ASTERISK; - try { - workStep = workflowException.getWorkStep(); - } catch (Exception ex) { - // keep default workStep value - } - //Extract error data to be returned to WorkflowAction - execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); - RainyDayHandlerStatus rainyDayHandlerStatus; - String handlingCode = ""; - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); - if(rainyDayHandlerStatus==null){ - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } + //Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + RainyDayHandlerStatus rainyDayHandlerStatus; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); if(rainyDayHandlerStatus==null){ - handlingCode = "Abort"; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + if(rainyDayHandlerStatus==null){ + handlingCode = "Abort"; + }else{ + if(primaryPolicy){ + handlingCode = rainyDayHandlerStatus.getPolicy(); + }else{ + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } + } }else{ if(primaryPolicy){ handlingCode = rainyDayHandlerStatus.getPolicy(); @@ -120,26 +131,20 @@ public class ExecuteBuildingBlockRainyDay { handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); } } - }else{ - if(primaryPolicy){ - handlingCode = rainyDayHandlerStatus.getPolicy(); - }else{ - handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + if(!primaryPolicy){ + try{ + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + request.setRetryStatusMessage("Retries have been exhausted."); + requestDbclient.updateInfraActiveRequests(request); + } catch(Exception ex){ + msoLogger.debug(ex.toString()); + msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status"); + } } - } - if(!primaryPolicy){ - try{ - InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retries have been exhausted."); - requestDbclient.updateInfraActiveRequests(request); - } catch(Exception ex){ - msoLogger.debug(ex.toString()); - msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status"); + if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ + handlingCode = "Rollback"; } } - if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ - handlingCode = "Rollback"; - } msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn index 0e99ce9683..403be98c8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn @@ -13,7 +13,7 @@ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def cvgn= new ConfirmVolumeGroupName() +def cvgn= new ConfirmVolumeGroupNameFactory().create() cvgn.handleAAIQueryFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/> @@ -25,7 +25,7 @@ cvgn.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def cvgn= new ConfirmVolumeGroupName() +def cvgn= new ConfirmVolumeGroupNameFactory().create() cvgn.queryAAIForVolumeGroupId(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForVolumeGroupId" targetRef="ExclusiveGateway_3"/> @@ -33,7 +33,7 @@ cvgn.queryAAIForVolumeGroupId(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def cvgn= new ConfirmVolumeGroupName() +def cvgn= new ConfirmVolumeGroupNameFactory().create() cvgn.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForVolumeGroupId"/> @@ -42,7 +42,7 @@ cvgn.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def cvgn= new ConfirmVolumeGroupName() +def cvgn= new ConfirmVolumeGroupNameFactory().create() cvgn.checkAAIQueryResult(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="CheckAAIQueryResult" targetRef="ExclusiveGateway_1"/> @@ -50,7 +50,7 @@ cvgn.checkAAIQueryResult(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def cvgn= new ConfirmVolumeGroupName() +def cvgn= new ConfirmVolumeGroupNameFactory().create() cvgn.handleVolumeGroupNameNoMatch(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_7"> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index 990863ec93..6914e7575f 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -70,6 +70,7 @@ falloutHandler.postProcessResponse(execution)]]></bpmn2:script> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload"> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn index 2ae2ff7f8b..0032b0e0b7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.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="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.13.1" 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="_l2hJ8CccEeW3d--PaFJMbg" 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:process id="sdncAdapter" name="SDNC Adapter" isExecutable="true"> <bpmn2:exclusiveGateway id="isResponseOK" name="is Response Ok?" default="badSynchronousResponse"> <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming> @@ -8,28 +8,29 @@ </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="badSynchronousResponse" name="Bad synchronous response" sourceRef="isResponseOK" targetRef="setBadResponse" /> <bpmn2:sequenceFlow id="goodSynchronousResponse" name="Good synchronous response" sourceRef="isResponseOK" targetRef="resetCallbackRequest"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCA_ResponseCode")=='200'}</bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCA_ResponseCode")=='200'}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:scriptTask id="setBadResponse" name="Set Bad Response Exception" scriptFormat="groovy"> <bpmn2:incoming>badSynchronousResponse</bpmn2:incoming> <bpmn2:outgoing>Exception</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* int responseCode = execution.getVariable("SDNCA_ResponseCode") ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )</bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="Exception" name="Exception" sourceRef="setBadResponse" targetRef="badResponseEndFlow" /> <bpmn2:serviceTask id="invokeSDNCAdapter" name="Invoke SDNC Adapter" camunda:asyncAfter="true" camunda:class=""> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${execution.getVariable("mso.adapters.sdnc.endpoint")}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${execution.getVariable("mso.adapters.sdnc.endpoint")}]]></camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValue}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID"><![CDATA[#{execution.getVariable("mso-request-id")}]]></camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${sdncAdapterRequest}</camunda:inputParameter> @@ -65,20 +66,18 @@ exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate wit </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.preProcessRequest(execution) -</bpmn2:script> +sdnc.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="processMessage" targetRef="invokeSDNCAdapter" /> <bpmn2:scriptTask id="returnWorkflowResult" name="Return workflow result" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_11ah5pw</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.postProcessResponse(execution) -</bpmn2:script> +sdnc.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_14" sourceRef="returnWorkflowResult" targetRef="timeoutError" /> <bpmn2:exclusiveGateway id="timeoutError" name="Did Timeout occur?" default="noTimeoutError"> @@ -88,7 +87,7 @@ sdnc.postProcessResponse(execution) </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="noTimeoutError" name="No Timeout" sourceRef="timeoutError" targetRef="ExclusiveGateway_1" /> <bpmn2:sequenceFlow id="SequenceFlow_19" name="Timeout" sourceRef="timeoutError" targetRef="endEventException"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("asynchronousResponseTimeout")==true}</bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("asynchronousResponseTimeout")==true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:subProcess id="SubProcess" name="Wait for asynchronous message" camunda:asyncAfter="true"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> @@ -111,17 +110,17 @@ sdnc.postProcessResponse(execution) <bpmn2:scriptTask id="setTimeoutEx" name="Set Timeout and Stop Listening for Callback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0mzs1ze</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11ah5pw</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.setTimeout(execution)</bpmn2:script> +sdnc.setTimeout(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="resetCallbackRequest" name="Reset callback request and set timer value" scriptFormat="groovy"> <bpmn2:incoming>goodSynchronousResponse</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.resetCallbackRequest(execution)</bpmn2:script> +sdnc.resetCallbackRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="resetCallbackRequest" targetRef="SubProcess" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Check final indicator" default="Done"> @@ -131,14 +130,14 @@ sdnc.resetCallbackRequest(execution)</bpmn2:script> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="Done" name="Done" sourceRef="ExclusiveGateway_1" targetRef="ResetInterimNotificationFlag" /> <bpmn2:sequenceFlow id="SequenceFlow_30" name="Not Done" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("continueListening")==true}</bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("continueListening")==true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:scriptTask id="toggleSuccessIndicator" name="Toggle Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1w1za5m</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.toggleSuccessIndicator(execution)</bpmn2:script> +sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_17" name="" sourceRef="toggleSuccessIndicator" targetRef="endEventFlow" /> <bpmn2:endEvent id="endEventFlow" name="End Event Flow"> @@ -168,9 +167,9 @@ sdnc.toggleSuccessIndicator(execution)</bpmn2:script> <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.assignError(execution)</bpmn2:script> +sdnc.assignError(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="assignError" targetRef="EndEvent_5" /> <bpmn2:endEvent id="EndEvent_5"> @@ -183,7 +182,7 @@ sdnc.assignError(execution)</bpmn2:script> <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_4" name="Yes" sourceRef="ExclusiveGateway_2" targetRef="SetInterimNotificationFlag"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("serviceConfigActivate")==true}</bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("serviceConfigActivate")==true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_23" name="No" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_1" /> <bpmn2:endEvent id="EndEvent_1"> @@ -215,7 +214,7 @@ sdnc.assignError(execution)</bpmn2:script> <bpmn2:scriptTask id="SetInterimNotificationFlag" name="Set Interim Notification Flag" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_193cb6p</bpmn2:outgoing> - <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", true)</bpmn2:script> + <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", true)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_193cb6p" sourceRef="SetInterimNotificationFlag" targetRef="CallActivity_11xgv33" /> <bpmn2:endEvent id="EndEvent_18rq0b6"> @@ -225,9 +224,27 @@ sdnc.assignError(execution)</bpmn2:script> <bpmn2:scriptTask id="ResetInterimNotificationFlag" name="Reset Interim Notification Flag" scriptFormat="groovy"> <bpmn2:incoming>Done</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1w1za5m</bpmn2:outgoing> - <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", false)</bpmn2:script> + <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", false)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1w1za5m" sourceRef="ResetInterimNotificationFlag" targetRef="toggleSuccessIndicator" /> + <bpmn2:subProcess id="SubProcess_1j2zu8s" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_10rxj2o"> + <bpmn2:outgoing>SequenceFlow_1cnxq0j</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_2" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_0tzire9"> + <bpmn2:incoming>SequenceFlow_1j9sip1</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1cnxq0j" sourceRef="StartEvent_10rxj2o" targetRef="Task_1damf23" /> + <bpmn2:sequenceFlow id="SequenceFlow_1j9sip1" sourceRef="Task_1damf23" targetRef="EndEvent_0tzire9" /> + <bpmn2:scriptTask id="Task_1damf23" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1cnxq0j</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1j9sip1</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + </bpmn2:subProcess> </bpmn2:process> <bpmn2:message id="Message_1" name="sdncAdapterWorkflowRequest" /> <bpmn2:message id="Message_2" name="sdncAdapterCallbackRequest" /> @@ -264,23 +281,23 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="badSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_24"> - <di:waypoint x="544" y="153" /> - <di:waypoint x="544" y="122" /> - <di:waypoint x="600" y="122" /> + <di:waypoint xsi:type="dc:Point" x="544" y="153" /> + <di:waypoint xsi:type="dc:Point" x="544" y="122" /> + <di:waypoint xsi:type="dc:Point" x="600" y="122" /> <bpmndi:BPMNLabel> <dc:Bounds x="441" y="99" width="164" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_33" targetElement="_BPMNShape_ScriptTask_3"> - <di:waypoint x="147" y="179" /> - <di:waypoint x="194" y="179" /> + <di:waypoint xsi:type="dc:Point" x="147" y="179" /> + <di:waypoint xsi:type="dc:Point" x="194" y="179" /> <bpmndi:BPMNLabel> <dc:Bounds x="171" y="179" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="goodSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_27"> - <di:waypoint x="544" y="203" /> - <di:waypoint x="544" y="246" /> + <di:waypoint xsi:type="dc:Point" x="544" y="203" /> + <di:waypoint xsi:type="dc:Point" x="544" y="246" /> <bpmndi:BPMNLabel> <dc:Bounds x="459" y="208" width="172" height="22" /> </bpmndi:BPMNLabel> @@ -292,24 +309,24 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="194" y="139" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_3" targetElement="_BPMNShape_ServiceTask_62"> - <di:waypoint x="294" y="179" /> - <di:waypoint x="342" y="179" /> + <di:waypoint xsi:type="dc:Point" x="294" y="179" /> + <di:waypoint xsi:type="dc:Point" x="342" y="179" /> <bpmndi:BPMNLabel> <dc:Bounds x="300" y="153" width="30" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ServiceTask_68" targetElement="_BPMNShape_ExclusiveGateway_53"> - <di:waypoint x="1204" y="277" /> - <di:waypoint x="1248" y="276" /> + <di:waypoint xsi:type="dc:Point" x="1204" y="277" /> + <di:waypoint xsi:type="dc:Point" x="1248" y="276" /> <bpmndi:BPMNLabel> <dc:Bounds x="1211" y="251" width="37" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ServiceTask_62" targetElement="_BPMNShape_ExclusiveGateway_29"> - <di:waypoint x="442" y="179" /> - <di:waypoint x="480" y="179" /> - <di:waypoint x="480" y="178" /> - <di:waypoint x="519" y="178" /> + <di:waypoint xsi:type="dc:Point" x="442" y="179" /> + <di:waypoint xsi:type="dc:Point" x="480" y="179" /> + <di:waypoint xsi:type="dc:Point" x="480" y="178" /> + <di:waypoint xsi:type="dc:Point" x="519" y="178" /> <bpmndi:BPMNLabel> <dc:Bounds x="468" y="153" width="37" height="22" /> </bpmndi:BPMNLabel> @@ -330,8 +347,8 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SubProcess_11"> - <di:waypoint x="998" y="278" /> - <di:waypoint x="1104" y="277" /> + <di:waypoint xsi:type="dc:Point" x="998" y="278" /> + <di:waypoint xsi:type="dc:Point" x="1104" y="277" /> <bpmndi:BPMNLabel> <dc:Bounds x="1051" y="262.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -340,8 +357,8 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="600" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="Exception" sourceElement="_BPMNShape_ScriptTask_24" targetElement="_BPMNShape_EndEvent_65"> - <di:waypoint x="700" y="122" /> - <di:waypoint x="762" y="122" /> + <di:waypoint xsi:type="dc:Point" x="700" y="122" /> + <di:waypoint xsi:type="dc:Point" x="762" y="122" /> <bpmndi:BPMNLabel> <dc:Bounds x="699" y="99" width="64" height="22" /> </bpmndi:BPMNLabel> @@ -350,8 +367,8 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="941" y="372" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_IntermediateCatchEvent_16"> - <di:waypoint x="817" y="275" /> - <di:waypoint x="926" y="275" /> + <di:waypoint xsi:type="dc:Point" x="817" y="275" /> + <di:waypoint xsi:type="dc:Point" x="926" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="872" y="260" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -363,16 +380,16 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="noTimeoutError" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ExclusiveGateway_54"> - <di:waypoint x="1273" y="301" /> - <di:waypoint x="1273" y="359" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="301" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="359" /> <bpmndi:BPMNLabel> <dc:Bounds x="1280" y="324" width="72" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ScriptTask_25"> - <di:waypoint x="1273" y="251" /> - <di:waypoint x="1273" y="95" /> - <di:waypoint x="1560" y="95" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="251" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="95" /> + <di:waypoint xsi:type="dc:Point" x="1560" y="95" /> <bpmndi:BPMNLabel> <dc:Bounds x="1301" y="169.45283018867923" width="39" height="12" /> </bpmndi:BPMNLabel> @@ -384,8 +401,8 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="Done" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_247"> - <di:waypoint x="1298" y="384" /> - <di:waypoint x="1386" y="385" /> + <di:waypoint xsi:type="dc:Point" x="1298" y="384" /> + <di:waypoint xsi:type="dc:Point" x="1386" y="385" /> <bpmndi:BPMNLabel> <dc:Bounds x="1322" y="384.219838851959" width="27" height="13" /> </bpmndi:BPMNLabel> @@ -394,17 +411,17 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="494" y="246" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_27" targetElement="_BPMNShape_SubProcess_11"> - <di:waypoint x="594" y="286" /> - <di:waypoint x="607" y="286" /> - <di:waypoint x="607" y="275" /> - <di:waypoint x="619" y="275" /> + <di:waypoint xsi:type="dc:Point" x="594" y="286" /> + <di:waypoint xsi:type="dc:Point" x="607" y="286" /> + <di:waypoint xsi:type="dc:Point" x="607" y="275" /> + <di:waypoint xsi:type="dc:Point" x="619" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="622" y="280.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ParallelGateway_14"> - <di:waypoint x="1273" y="409" /> - <di:waypoint x="1273" y="467" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="409" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="467" /> <bpmndi:BPMNLabel> <dc:Bounds x="1273" y="423" width="60" height="22" /> </bpmndi:BPMNLabel> @@ -416,8 +433,8 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="CallActivity_11xgv33_di"> - <di:waypoint x="1273" y="602" /> - <di:waypoint x="1273" y="664" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="602" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="664" /> <bpmndi:BPMNLabel> <dc:Bounds x="1237" y="635.9906427957554" width="18" height="13" /> </bpmndi:BPMNLabel> @@ -429,8 +446,8 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_ParallelGateway_14"> - <di:waypoint x="1272" y="516" /> - <di:waypoint x="1273" y="552" /> + <di:waypoint xsi:type="dc:Point" x="1272" y="516" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="552" /> <bpmndi:BPMNLabel> <dc:Bounds x="1273" y="519" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -442,17 +459,17 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="_BPMNShape_EndEvent_96"> - <di:waypoint x="1298" y="577" /> - <di:waypoint x="1330" y="577" /> - <di:waypoint x="1440" y="577" /> + <di:waypoint xsi:type="dc:Point" x="1298" y="577" /> + <di:waypoint xsi:type="dc:Point" x="1330" y="577" /> + <di:waypoint xsi:type="dc:Point" x="1440" y="577" /> <bpmndi:BPMNLabel> <dc:Bounds x="1309" y="590.5" width="14" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ParallelGateway_14" targetElement="_BPMNShape_ScriptTask_27"> - <di:waypoint x="1248" y="492" /> - <di:waypoint x="544" y="492" /> - <di:waypoint x="544" y="326" /> + <di:waypoint xsi:type="dc:Point" x="1248" y="492" /> + <di:waypoint xsi:type="dc:Point" x="544" y="492" /> + <di:waypoint xsi:type="dc:Point" x="544" y="326" /> <bpmndi:BPMNLabel> <dc:Bounds x="782" y="467" width="73" height="48" /> </bpmndi:BPMNLabel> @@ -461,47 +478,47 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="1540" y="344" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ScriptTask_247" targetElement="_BPMNShape_EndEvent_64"> - <di:waypoint x="1640" y="384" /> - <di:waypoint x="1699" y="384" /> + <di:waypoint xsi:type="dc:Point" x="1640" y="384" /> + <di:waypoint xsi:type="dc:Point" x="1699" y="384" /> <bpmndi:BPMNLabel> <dc:Bounds x="1670" y="369" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_19" bpmnElement="errorHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="207" y="692" width="353" height="193" /> + <dc:Bounds x="250" y="598" width="353" height="193" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="catchErrors"> - <dc:Bounds x="242" y="771" width="36" height="36" /> + <dc:Bounds x="285" y="677" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="245" y="812" width="29" height="12" /> + <dc:Bounds x="288" y="718" width="29" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_5"> - <dc:Bounds x="482" y="771" width="36" height="36" /> + <dc:Bounds x="525" y="677" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="455" y="812" width="90" height="0" /> + <dc:Bounds x="498" y="718" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_249" bpmnElement="assignError"> - <dc:Bounds x="326" y="749" width="100" height="80" /> + <dc:Bounds x="369" y="655" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_249"> - <di:waypoint x="278" y="789" /> - <di:waypoint x="326" y="789" /> + <di:waypoint xsi:type="dc:Point" x="321" y="695" /> + <di:waypoint xsi:type="dc:Point" x="369" y="695" /> <bpmndi:BPMNLabel> - <dc:Bounds x="263" y="789" width="90" height="0" /> + <dc:Bounds x="306" y="695" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ScriptTask_249" targetElement="_BPMNShape_EndEvent_213"> - <di:waypoint x="426" y="789" /> - <di:waypoint x="482" y="789" /> + <di:waypoint xsi:type="dc:Point" x="469" y="695" /> + <di:waypoint xsi:type="dc:Point" x="525" y="695" /> <bpmndi:BPMNLabel> - <dc:Bounds x="409" y="789" width="90" height="0" /> + <dc:Bounds x="452" y="695" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1eciucn_di" bpmnElement="SequenceFlow_1eciucn"> - <di:waypoint x="691" y="275" /> - <di:waypoint x="781" y="275" /> + <di:waypoint xsi:type="dc:Point" x="691" y="275" /> + <di:waypoint xsi:type="dc:Point" x="781" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="736" y="260" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -519,17 +536,17 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mzs1ze_di" bpmnElement="SequenceFlow_0mzs1ze"> - <di:waypoint x="800" y="364" /> - <di:waypoint x="800" y="412" /> - <di:waypoint x="941" y="412" /> + <di:waypoint xsi:type="dc:Point" x="800" y="364" /> + <di:waypoint xsi:type="dc:Point" x="800" y="412" /> + <di:waypoint xsi:type="dc:Point" x="941" y="412" /> <bpmndi:BPMNLabel> <dc:Bounds x="815" y="388" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11ah5pw_di" bpmnElement="SequenceFlow_11ah5pw"> - <di:waypoint x="1041" y="412" /> - <di:waypoint x="1154" y="412" /> - <di:waypoint x="1154" y="317" /> + <di:waypoint xsi:type="dc:Point" x="1041" y="412" /> + <di:waypoint xsi:type="dc:Point" x="1154" y="412" /> + <di:waypoint xsi:type="dc:Point" x="1154" y="317" /> <bpmndi:BPMNLabel> <dc:Bounds x="1098" y="397" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -547,8 +564,8 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="1223" y="666" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_193cb6p_di" bpmnElement="SequenceFlow_193cb6p"> - <di:waypoint x="1273" y="746" /> - <di:waypoint x="1273" y="795" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="746" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="795" /> <bpmndi:BPMNLabel> <dc:Bounds x="1288" y="770.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -560,8 +577,8 @@ sdnc.assignError(execution)</bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1em7gys_di" bpmnElement="SequenceFlow_1em7gys"> - <di:waypoint x="1273" y="875" /> - <di:waypoint x="1273" y="920" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="875" /> + <di:waypoint xsi:type="dc:Point" x="1273" y="920" /> <bpmndi:BPMNLabel> <dc:Bounds x="1288" y="897.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -570,12 +587,44 @@ sdnc.assignError(execution)</bpmn2:script> <dc:Bounds x="1386" y="345" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1w1za5m_di" bpmnElement="SequenceFlow_1w1za5m"> - <di:waypoint x="1486" y="385" /> - <di:waypoint x="1540" y="384" /> + <di:waypoint xsi:type="dc:Point" x="1486" y="385" /> + <di:waypoint xsi:type="dc:Point" x="1540" y="384" /> <bpmndi:BPMNLabel> <dc:Bounds x="1513" y="369.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_009jbzr_di" bpmnElement="SubProcess_1j2zu8s" isExpanded="true"> + <dc:Bounds x="252" y="817" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1cwwku2_di" bpmnElement="StartEvent_10rxj2o"> + <dc:Bounds x="288" y="904" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="306" y="944" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0tzire9_di" bpmnElement="EndEvent_0tzire9"> + <dc:Bounds x="530" y="904" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="548" y="944" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1cnxq0j_di" bpmnElement="SequenceFlow_1cnxq0j"> + <di:waypoint xsi:type="dc:Point" x="324" y="922" /> + <di:waypoint xsi:type="dc:Point" x="378" y="922" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="351" y="901" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1j9sip1_di" bpmnElement="SequenceFlow_1j9sip1"> + <di:waypoint xsi:type="dc:Point" x="478" y="922" /> + <di:waypoint xsi:type="dc:Point" x="530" y="922" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="504" y="901" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1n6d3r0_di" bpmnElement="Task_1damf23"> + <dc:Bounds x="378" y="882" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy new file mode 100644 index 0000000000..d6a7cf0634 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake +import org.json.JSONArray +import org.json.JSONObject +import org.junit.Before +import org.junit.Test +import org.onap.logging.ref.slf4j.ONAPLogConstants +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.utils.TargetEntity +import org.skyscreamer.jsonassert.JSONAssert +import org.skyscreamer.jsonassert.JSONCompareMode +import org.springframework.core.env.Environment + +import javax.ws.rs.core.MediaType +import javax.ws.rs.core.Response + +import static org.assertj.core.api.Assertions.assertThat +import static org.mockito.ArgumentMatchers.anyString +import static org.mockito.Mockito.eq +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.when +import static org.mockito.Mockito.verify + +class CatalogDbUtilsTest { + + private static final String AUTHORIZATION_HEADER = "AuthHeaderTest" + private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," + + "\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}" + private HttpClientFactory httpClientFactoryMock + private MsoUtils msoUtilsMock + private JsonUtils jsonUtilsMock + private HttpClient httpClientMock + private DelegateExecutionFake executionFake + private CatalogDbUtils testedObject + + + @Before + void setUp() { + httpClientFactoryMock = mock(HttpClientFactory.class) + msoUtilsMock = mock(MsoUtils.class) + jsonUtilsMock = mock(JsonUtils.class) + httpClientMock = mock(HttpClient.class) + executionFake = new DelegateExecutionFake() + testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock) + } + + @Test + void getAllVnfsByVnfModelCustomizationUuid_CatVer1_success() { + // given + executionFake.setVariable("BasicAuthHeaderValueDB", AUTHORIZATION_HEADER) + mockGetResponseFromCatalogDb("http://testUrl/v2/serviceVnfs?vnfModelCustomizationUuid=testModel") + //when + JSONArray vnfsListResult = testedObject.getAllVnfsByVnfModelCustomizationUuid(executionFake, "testModel", "v1") + //then + verifyHeadersInHttpClient() + JSONAssert.assertEquals("[{\"vfModules\":[{\"initialCount\":1,\"modelInfo\":{\"modelType\":\"vfModule\"},\"isBase\":true}],\"modelInfo\":{\"modelType\":\"vnf\"}}]", vnfsListResult, JSONCompareMode.LENIENT) + } + + @Test + void getAllVnfsByVnfModelCustomizationUuid_CatVer2_success() { + // given + executionFake.setVariable("BasicAuthHeaderValueDB", AUTHORIZATION_HEADER) + mockGetResponseFromCatalogDb("http://testUrl/v2/serviceVnfs?vnfModelCustomizationUuid=testModel") + // when + JSONArray vnfsListResult = testedObject.getAllVnfsByVnfModelCustomizationUuid(executionFake, "testModel", "v2") + // then + verifyHeadersInHttpClient() + JSONAssert.assertEquals("[{\"vfModules\":[{\"initialCount\":1,\"name\":\"module1\",\"isBase\":true}],\"name\":\"service1\"}]", vnfsListResult, JSONCompareMode.LENIENT) + } + + @Test + void getServiceResourcesByServiceModelUuid_success() { + // given + executionFake.setVariable("BasicAuthHeaderValueDB", AUTHORIZATION_HEADER) + mockGetResponseFromCatalogDb("http://testUrl/v2/serviceResources?serviceModelUuid=testModel") + // when + JSONObject result = testedObject.getServiceResourcesByServiceModelUuid(executionFake, "testModel", "v2") + // then + verifyHeadersInHttpClient() + JSONAssert.assertEquals("{\"serviceVnfs\": [{\"name\": \"service1\",\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}", result, JSONCompareMode.LENIENT) + } + + + @Test + void getServiceResourcesByServiceModelInvariantUuidString_success() { + // given + executionFake.setVariable("BasicAuthHeaderValueDB", AUTHORIZATION_HEADER) + mockGetResponseFromCatalogDb("http://testUrl/v2/serviceResources?serviceModelInvariantUuid=testModel") + // when + String result = testedObject.getServiceResourcesByServiceModelInvariantUuidString(executionFake, "testModel") + // then + verifyHeadersInHttpClient() + assertThat(result).isEqualTo(RESPONSE_FROM_CATALOG_DB) + } + + private Environment createEnvironmentMock() { + Environment mockEnvironment = mock(Environment.class) + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(mockEnvironment) + return mockEnvironment + } + + private void mockGetResponseFromCatalogDb(String queryEndpoint) { + Environment environmentMock = createEnvironmentMock() + when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl") + when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock) + + Response responseMock = mock(Response.class) + when(httpClientMock.get()).thenReturn(responseMock) + when(responseMock.readEntity(String.class)) thenReturn(RESPONSE_FROM_CATALOG_DB) + when(responseMock.getStatus()).thenReturn(200) + } + + private void verifyHeadersInHttpClient() { + verify(httpClientMock).addAdditionalHeader(eq(ONAPLogConstants.Headers.REQUEST_ID), anyString()) + verify(httpClientMock).addAdditionalHeader("X-FromAppId", "BPMN") + verify(httpClientMock).addAdditionalHeader("Accept", MediaType.APPLICATION_JSON) + verify(httpClientMock).addAdditionalHeader("Authorization", AUTHORIZATION_HEADER) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index a96127aa2d..79aacdfbe9 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,64 +22,216 @@ package org.onap.so.bpmn.common.scripts -import static org.mockito.Mockito.* - -import javax.ws.rs.core.UriBuilder - +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake -import org.junit.Assert import org.junit.Before import org.junit.Test -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito +import org.mockito.Mock import org.mockito.MockitoAnnotations -import org.mockito.Spy +import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.VolumeGroup +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.constants.Defaults +import org.springframework.http.HttpStatus + +import javax.ws.rs.core.UriBuilder + +import static org.assertj.core.api.Assertions.catchThrowableOfType +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertFalse +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.when + +class ConfirmVolumeGroupNameTest { + + private static final AAIResourceUri RESOURCE_URI = AAIUriFactory.createResourceFromExistingURI( + AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()) + + private ConfirmVolumeGroupName confirmVolumeGroupName + @Mock + private VolumeGroup volumeGroup + @Mock + private AAIResourcesClient client + private ExceptionUtilFake exceptionUtilFake + + private DelegateExecution delegateExecution + + @Before + public void init() throws IOException { + exceptionUtilFake = new ExceptionUtilFake() + confirmVolumeGroupName = spy(new ConfirmVolumeGroupName(exceptionUtilFake)) + MockitoAnnotations.initMocks(this) + delegateExecution = new DelegateExecutionFake() + volumeGroup = createVolumeGroup() + when(confirmVolumeGroupName.getAAIClient()).thenReturn(client) + } + + @Test + public void preProcessRequest_shouldSetUpVariables() { + String volumeGroupId = "volume-group-id-1" + String volumeGroupName = "volume-group-name-1" + String aicCloudRegion = "aic-cloud-region-1" + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER, aicCloudRegion, volumeGroupId) + + delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupId", volumeGroupId) + delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupName", volumeGroupName) + delegateExecution.setVariable("ConfirmVolumeGroupName_aicCloudRegion", aicCloudRegion) + delegateExecution.setVariable("CVGN_volumeGroupGetEndpoint", uri) + + confirmVolumeGroupName.preProcessRequest(delegateExecution) + + assertEquals(ConfirmVolumeGroupName.Prefix, delegateExecution.getVariable("prefix")) + + assertEquals(volumeGroupId, delegateExecution.getVariable("CVGN_volumeGroupId")) + assertEquals(volumeGroupName, delegateExecution.getVariable("CVGN_volumeGroupName")) + assertEquals(aicCloudRegion, delegateExecution.getVariable("CVGN_aicCloudRegion")) + } + + @Test + public void queryAAIForVolumeGroupId_shouldSucceed_whenVolumeGroupExists() { + delegateExecution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.OK) + delegateExecution.setVariable("CVGN_queryVolumeGroupResponse", volumeGroup) + delegateExecution.setVariable("CVGN_volumeGroupGetEndpoint", RESOURCE_URI) + when(client.get(VolumeGroup.class, RESOURCE_URI)).thenReturn(Optional.of(volumeGroup)) + + confirmVolumeGroupName.queryAAIForVolumeGroupId(delegateExecution) + + assertEquals(HttpStatus.OK.value(), delegateExecution.getVariable("CVGN_queryVolumeGroupResponseCode")) + assertEquals(volumeGroup, delegateExecution.getVariable("CVGN_queryVolumeGroupResponse")) + } + + @Test + public void queryAAIForVolumeGroupId_shouldFailWith404_whenVolumeGroupDoesNotExist() { + delegateExecution.setVariable("CVGN_volumeGroupGetEndpoint", RESOURCE_URI) + when(client.get(VolumeGroup.class, RESOURCE_URI)).thenReturn(Optional.empty()) + + confirmVolumeGroupName.queryAAIForVolumeGroupId(delegateExecution) + + assertEquals(HttpStatus.NOT_FOUND.value(), delegateExecution.getVariable("CVGN_queryVolumeGroupResponseCode")) + assertEquals("Volume Group not Found!", delegateExecution.getVariable("CVGN_queryVolumeGroupResponse")) + } + + @Test + public void queryAAIForVolumeGroupId_shouldThrowWorkflowException_whenRuntimeExceptionIsThrown() throws BpmnError { + delegateExecution.setVariable("CVGN_volumeGroupGetEndpoint", RESOURCE_URI) + delegateExecution.setVariable("testProcessKey", "process-key1") + + def errorMsg = "my runtime exception" + when(client.get(VolumeGroup.class, RESOURCE_URI)).thenThrow(new RuntimeException(errorMsg)) + + def exceptionMsg = "AAI GET Failed" + + BpmnError error = catchThrowableOfType( + { -> confirmVolumeGroupName.queryAAIForVolumeGroupId(delegateExecution) }, BpmnError.class) + + assertEquals(String.format("MSOWorkflowException: %s", exceptionMsg), error.getMessage()) + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value().toString(), error.getErrorCode()) + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), delegateExecution.getVariable("CVGN_queryVolumeGroupResponseCode")) + assertEquals(String.format("AAI GET Failed:%s", errorMsg), delegateExecution.getVariable("CVGN_queryVolumeGroupResponse")) + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), exceptionUtilFake.getErrorCode()) + assertEquals(exceptionMsg, exceptionUtilFake.getErrorMessage()) + assertEquals(delegateExecution, exceptionUtilFake.getDelegateExecution()) + } + + @Test + public void checkAAIQueryResult_shouldSetVolumeGroupNameMatchesToFalse_whenResponseCodeIs404() { + delegateExecution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.NOT_FOUND) + delegateExecution.setVariable("CVGN_volumeGroupName", "") + + confirmVolumeGroupName.checkAAIQueryResult(delegateExecution) + + assertFalse(delegateExecution.getVariable("CVGN_volumeGroupNameMatches")) + } + + @Test + public void checkAAIQueryResult_shouldSetVolumeGroupNameMatchesToTrue_whenResponseCodeIs200AndVolumeGroupNameExists() { + delegateExecution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.OK.value()) + delegateExecution.setVariable("CVGN_queryVolumeGroupResponse", volumeGroup) + delegateExecution.setVariable("CVGN_volumeGroupName", volumeGroup.getVolumeGroupName()) + + confirmVolumeGroupName.checkAAIQueryResult(delegateExecution) + + assertTrue(delegateExecution.getVariable("CVGN_volumeGroupNameMatches")) + } + + @Test + public void handleVolumeGroupNameNoMatch_shouldThrowBpmnErrorException() { + def volumeGroupId = "volume-group-id" + def volumeGroupName = "volume-group-name" + + delegateExecution.setVariable("CVGN_volumeGroupId", volumeGroupId) + delegateExecution.setVariable("CVGN_volumeGroupName", volumeGroupName) + + def errorMessage = String.format("Error occurred - volume group id %s is not associated with %s", + delegateExecution.getVariable('CVGN_volumeGroupId'), delegateExecution.getVariable('CVGN_volumeGroupName')) + + BpmnError error = catchThrowableOfType( + { -> confirmVolumeGroupName.handleVolumeGroupNameNoMatch(delegateExecution) }, BpmnError.class) + + assertEquals(String.format("MSOWorkflowException: %s", errorMessage), error.getMessage()) + assertEquals("1002", error.getErrorCode()) + + assertEquals(1002, exceptionUtilFake.getErrorCode()) + assertEquals(errorMessage, exceptionUtilFake.getErrorMessage()) + assertEquals(delegateExecution, exceptionUtilFake.getDelegateExecution()) + } + + @Test + public void reportSuccess_shouldSetWorkflowResponseToEmptyString() { + confirmVolumeGroupName.reportSuccess(delegateExecution) + assertEquals("", delegateExecution.getVariable("WorkflowResponse")) + } + + private VolumeGroup createVolumeGroup() { + VolumeGroup volumeGroup = new VolumeGroup() + + volumeGroup.setVolumeGroupId("volume-group-id") + volumeGroup.setVolumeGroupName("volume-group-name") + volumeGroup.setHeatStackId("heat-stack-id") + volumeGroup.setVnfType("vnf-type") + volumeGroup.setOrchestrationStatus("orchestration-status") + volumeGroup.setModelCustomizationId("model-customization-id") + volumeGroup.setVfModuleModelCustomizationId("vf-module-model-customization-id") + volumeGroup.setResourceVersion("resource-version") + volumeGroup.setRelationshipList(new RelationshipList()) + + return volumeGroup + } + + private static class ExceptionUtilFake extends ExceptionUtil { + + private int errorCode + private String errorMessage + private DelegateExecution execution + + @Override + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + this.errorCode = errorCode + this.errorMessage = errorMessage + this.execution = execution + throw new BpmnError(errorCode.toString(), "MSOWorkflowException: ${errorMessage}") + } + + public int getErrorCode() { + return errorCode + } + + public String getErrorMessage() { + return errorMessage + } + + public DelegateExecution getDelegateExecution() { + return execution + } + } -class ConfirmVolumeGroupNameTest extends MsoGroovyTest { - - @Spy - private ConfirmVolumeGroupName confirmVolumeGroupName; - - @Before - public void init() throws IOException { - super.init("ConfirmVolumeGroupName") - MockitoAnnotations.initMocks(this); - when(confirmVolumeGroupName.getAAIClient()).thenReturn(client) - - } - - @Test - public void testQueryAAIForVolumeGroupId() { - - AAIResourceUri resourceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()); - when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn(resourceUri) - VolumeGroup volumeGroup = new VolumeGroup() - volumeGroup.setVolumeGroupId("Test") - when(client.get(VolumeGroup.class,resourceUri)).thenReturn(Optional.of(volumeGroup)) - confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) - Mockito.verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode",200) - Mockito.verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse",volumeGroup) - } - - @Test - public void testQueryAAIForVolumeGroupId_404() { - AAIResourceUri resourceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()); - when(client.get(VolumeGroup.class, resourceUri)).thenReturn(Optional.empty()) - DelegateExecution execution = new DelegateExecutionFake() - try { - execution.setVariable("CVGN_volumeGroupGetEndpoint", resourceUri) - confirmVolumeGroupName.queryAAIForVolumeGroupId(execution) - } - catch(Exception ex){} - Assert.assertEquals(404, execution.getVariable("CVGN_queryVolumeGroupResponseCode")) - Assert.assertEquals("Volume Group not Found!", execution.getVariable("CVGN_queryVolumeGroupResponse")) - - } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy new file mode 100644 index 0000000000..db11cb6044 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -0,0 +1,200 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.scripts + +import org.assertj.core.api.AbstractAssert +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Test +import org.onap.logging.ref.slf4j.ONAPLogConstants +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.utils.TargetEntity +import org.springframework.http.HttpStatus + +import javax.ws.rs.core.MediaType +import javax.ws.rs.core.Response + +import static org.assertj.core.api.Assertions.assertThat +import static org.assertj.core.api.Assertions.catchThrowableOfType +import static org.mockito.BDDMockito.given +import static org.mockito.BDDMockito.then +import static org.mockito.BDDMockito.willThrow +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.times + +class ExternalAPIUtilTest { + + private static final String URL = "http://someUrl" + private static final String UUID_STR = UUID.nameUUIDFromBytes("deterministic_uuid".getBytes()) + private static final String BODY_PAYLOAD = "payload" + + @Test + void executeExternalAPIGetCall_shouldPerformRestGetCall_withAuthorizationHeaderSet() { + // GIVEN + Response expectedResponse = createExpectedResponse(HttpStatus.ACCEPTED, BODY_PAYLOAD) + HttpClient httpClient = mock(HttpClient.class) + given(httpClient.get()).willReturn(expectedResponse) + HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) + given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + + // WHEN + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) + Response apiResponse = externalAPIUtil.executeExternalAPIGetCall(createDelegateExecution(), URL) + + // THEN + then(httpClient).should(times(1)).addBasicAuthHeader("value_externalapi_auth", "value_mso_msoKey") + then(httpClient).should(times(1)).addAdditionalHeader("X-FromAppId", "MSO") + then(httpClient).should(times(1)).addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID_STR) + then(httpClient).should(times(1)).addAdditionalHeader("Accept", MediaType.APPLICATION_JSON) + ResponseAssert.assertThat(apiResponse) + .hasStatusCode(HttpStatus.ACCEPTED) + .hasBody(BODY_PAYLOAD) + } + + @Test + void executeExternalAPIGetCall_shouldHandleExceptionsThrownByGetCall_andRethrowAsBpmnError() { + // GIVEN + HttpClient httpClient = mock(HttpClient.class) + willThrow(new RuntimeException("error occurred")).given(httpClient).get() + HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) + given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + DelegateExecution delegateExecution = createDelegateExecution() + DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() + + // WHEN + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), exceptionUtil) + BpmnError bpmnError = catchThrowableOfType({ -> + externalAPIUtil.executeExternalAPIGetCall(delegateExecution, URL) + }, BpmnError.class) + + // THEN + assertThat(exceptionUtil.getDelegateExecution()).isSameAs(delegateExecution) + assertThat(bpmnError.getMessage()).isEqualTo("error occurred") + assertThat(bpmnError.getErrorCode()).isEqualTo("9999") + } + + @Test + void executeExternalAPIPostCall_shouldHandleExceptionsThrownByPostCall_andRethrowAsBpmnError() { + // GIVEN + HttpClient httpClient = mock(HttpClient.class) + willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD) + HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) + given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + DelegateExecution delegateExecution = createDelegateExecution() + DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() + + // WHEN + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), exceptionUtil) + BpmnError bpmnError = catchThrowableOfType({ -> + externalAPIUtil.executeExternalAPIPostCall(delegateExecution, URL, BODY_PAYLOAD) + }, BpmnError.class) + + // THEN + assertThat(exceptionUtil.getDelegateExecution()).isSameAs(delegateExecution) + assertThat(bpmnError.getMessage()).isEqualTo("error occurred") + assertThat(bpmnError.getErrorCode()).isEqualTo("9999") + } + + @Test + void executeExternalAPIPostCall_shouldPerformRestPostCall_withPayloadAndAuthorizationHeaderSet() { + // GIVEN + Response expectedResponse = createExpectedResponse(HttpStatus.ACCEPTED, BODY_PAYLOAD) + HttpClient httpClient = mock(HttpClient.class) + given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse) + HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) + given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + + // WHEN + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) + Response apiResponse = externalAPIUtil.executeExternalAPIPostCall(createDelegateExecution(), URL, BODY_PAYLOAD) + + // THEN + then(httpClient).should(times(1)).addBasicAuthHeader("value_externalapi_auth", "value_mso_msoKey") + then(httpClient).should(times(1)).addAdditionalHeader("X-FromAppId", "MSO") + then(httpClient).should(times(1)).addAdditionalHeader("X-TransactionId", UUID_STR) + ResponseAssert.assertThat(apiResponse) + .hasStatusCode(HttpStatus.ACCEPTED) + .hasBody(BODY_PAYLOAD) + } + + private Response createExpectedResponse(HttpStatus httpStatus, String body) { + Response expectedResponse = mock(Response.class) + given(expectedResponse.getStatus()).willReturn(httpStatus.value()) + given(expectedResponse.getEntity()).willReturn(body) + return expectedResponse + } + + private DelegateExecution createDelegateExecution() { + DelegateExecution delegateExecution = mock(DelegateExecution.class) + given(delegateExecution.getVariable("URN_externalapi_auth")).willReturn("value_externalapi_auth") + given(delegateExecution.getVariable("URN_mso_msoKey")).willReturn("value_mso_msoKey") + return delegateExecution + } + + private static class ResponseAssert extends AbstractAssert<ResponseAssert, Response> { + + ResponseAssert(Response response) { + super(response, ResponseAssert.class) + } + + static ResponseAssert assertThat(Response response) { + return new ResponseAssert(response) + } + + ResponseAssert hasStatusCode(HttpStatus httpStatus) { + assertThat(actual.getStatus()).isEqualTo(httpStatus.value()) + return this + } + + ResponseAssert hasBody(String responseBody) { + assertThat(actual.getEntity()).isEqualTo(responseBody) + return this + } + } + + private static class DummyMsoUtils extends MsoUtils { + + private final String uuid + + DummyMsoUtils(String uuid) { + this.uuid = uuid + } + + String getRequestID() { + return uuid + } + } + + private static class DummyExceptionUtil extends ExceptionUtil { + + private DelegateExecution delegateExecution + + @Override + void buildAndThrowWorkflowException(DelegateExecution delegateExecution, int errorCode, String errorMessage) { + this.delegateExecution = delegateExecution + throw new BpmnError(String.valueOf(errorCode), errorMessage) + } + + DelegateExecution getDelegateExecution() { + return delegateExecution + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy index bf0f2d20c0..e351210586 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -1,22 +1,22 @@ -/*- - * ============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========================================================= - */ +/*- + * ============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.onap.so.bpmn.common.scripts @@ -39,7 +39,7 @@ import org.onap.so.bpmn.mock.FileUtil @RunWith(MockitoJUnitRunner.Silent.class) public class SDNCAdapterTest { - + @Before public void init() { @@ -47,7 +47,7 @@ public class SDNCAdapterTest { System.setProperty("jboss.qualified.host.name","myhost.com") } - + String workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -423,7 +423,7 @@ public class SDNCAdapterTest { </service-request> </rest:payload> </sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>""" - + def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:response-data> <tag0:CallbackHeader xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -453,7 +453,7 @@ String workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http:// <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage> <aetgt:ErrorCode>5300</aetgt:ErrorCode> </aetgt:WorkflowException>""" - + String enhancedCallbackRequestData = """<tag0:RequestData xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -536,7 +536,7 @@ String enhancedCallbackRequestData = <excluded-v4-address>192.168.1.7</excluded-v4-address> </excluded-v4-addresses> <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> + </v4-dhcp-pools> <use-v4-default-pool>Y</use-v4-default-pool> <excluded-v6-dhcp-addresses-from-default-pool> <excluded-v6-address>1:5</excluded-v6-address> @@ -567,7 +567,7 @@ String enhancedCallbackRequestData = <excluded-v6-address>2:2</excluded-v6-address> </excluded-v6-addresses> <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> + </v6-dhcp-pools> </dhcp> <firewall-lite> <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> @@ -694,7 +694,7 @@ String enhancedCallbackRequestData = </vr-lan-interface> <routing-protocol>none</routing-protocol> </vr-lan> -<ucpe-vms-service-information> +<ucpe-vms-service-information> <transport-service-information> <transport-service-type>AVPN</transport-service-type> <access-circuit-info> @@ -704,7 +704,7 @@ String enhancedCallbackRequestData = <access-circuit-info> <access-circuit-id>2</access-circuit-id> <dual-mode>Standby</dual-mode> - </access-circuit-info> + </access-circuit-info> </transport-service-information> <ucpe-information> <ucpe-host-name>hostname</ucpe-host-name> @@ -712,8 +712,8 @@ String enhancedCallbackRequestData = <out-of-band-management-modem>OOB</out-of-band-management-modem> </ucpe-information> <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> <vnf-sequence-number>1</vnf-sequence-number> <vnf-type>ZZ</vnf-type> <vnf-vendor>JUNIPER</vnf-vendor> @@ -724,8 +724,8 @@ String enhancedCallbackRequestData = <orchestration-status>1</orchestration-status> <equipment-role>1</equipment-role> </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> <vnf-sequence-number>2</vnf-sequence-number> <vnf-type>HY</vnf-type> <vnf-vendor>JUNIPER</vnf-vendor> @@ -735,9 +735,9 @@ String enhancedCallbackRequestData = <operational-state>2</operational-state> <orchestration-status>2</orchestration-status> <equipment-role>2</equipment-role> - </vnf-information> + </vnf-information> </vnf-list> - </ucpe-vms-service-information> + </ucpe-vms-service-information> <request-information> <request-action>Layer3ServiceActivateRequest</request-action> <order-number>4281555</order-number> @@ -815,7 +815,7 @@ def sdncAdapterResponseError = </sdncadapterworkflow:response-data> </sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - + @Test public void testPreProcessRequest() { @@ -823,34 +823,35 @@ def sdncAdapterResponseError = ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testReqId") when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - + SDNCAdapter sdncAdapter = new SDNCAdapter() sdncAdapter.preProcessRequest(mockExecution) - + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() debugger.printInvocations(mockExecution) - + verify(mockExecution).setVariable("prefix","SDNCA_") verify(mockExecution).setVariable("sdncAdapterResponse","") verify(mockExecution).setVariable("asynchronousResponseTimeout",false) verify(mockExecution).setVariable("continueListening",false) verify(mockExecution).setVariable("serviceConfigActivate",false) - verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) verify(mockExecution).setVariable("SDNCA_InterimNotify",false) verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic dGVzdDp0ZXN0") verify(mockExecution).setVariable("source","") + verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) } - + @Test public void testProcessResponse() { @@ -859,17 +860,17 @@ def sdncAdapterResponseError = when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) SDNCAdapter sdncAdapter = new SDNCAdapter() sdncAdapter.postProcessResponse(mockExecution) - + // MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() // debugger.printInvocations(mockExecution) - + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) + // verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) verify(mockExecution).setVariable("continueListening",false) - } - + } + @Test public void testProcessResponse_ErrorCase_404() { @@ -878,14 +879,14 @@ def sdncAdapterResponseError = when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) SDNCAdapter sdncAdapter = new SDNCAdapter() sdncAdapter.postProcessResponse(mockExecution) - + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) verify(mockExecution).setVariable("enhancedCallbackRequestData", "") verify(mockExecution).setVariable("continueListening",false) - + } - + @Test public void testProcessResponse_ErrorCase_InvalidCallback() { @@ -893,19 +894,19 @@ def sdncAdapterResponseError = when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>") SDNCAdapter sdncAdapter = new SDNCAdapter() sdncAdapter.postProcessResponse(mockExecution) - + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) verify(mockExecution).setVariable("enhancedCallbackRequestData", "") verify(mockExecution).setVariable("continueListening",false) } - + @Test public void postProcessResponse() { - - String SDNCAdapterCallbackRequest = + + String SDNCAdapterCallbackRequest = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -919,7 +920,7 @@ def sdncAdapterResponseError = data model content does not exist ]</ResponseMessage> </CallbackHeader> </SDNCAdapterCallbackRequest>""" - + String sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -940,7 +941,7 @@ def sdncAdapterResponseError = when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) SDNCAdapter sdncAdapter = new SDNCAdapter() sdncAdapter.postProcessResponse(mockExecution) - + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) verify(mockExecution).setVariable("enhancedCallbackRequestData", "") diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index cb9bb5c541..2d2f58b415 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -113,6 +113,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) doNothing().when(client).update(isA(AAIResourceUri.class), anyObject()) updateAAIVfModule.updateVfModule(mockExecution) + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200) } @Test @@ -128,6 +129,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404) } @@ -144,6 +146,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500) } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy index 77edd2dc6d..72cde00877 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,14 +34,14 @@ import static org.junit.Assert.*; @RunWith(MockitoJUnitRunner.class) public class VnfAdapterRestV1Test { - + @Before public void init() { MockitoAnnotations.initMocks(this) } - + @Test public void testPreProcessRequest() { @@ -59,11 +59,11 @@ public class VnfAdapterRestV1Test { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") - + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() vnfAdapterRestV1.preProcessRequest(mockExecution) - + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() //debugger.printInvocations(mockExecution) @@ -78,7 +78,7 @@ public class VnfAdapterRestV1Test { verify(mockExecution).setVariable("VNFREST_vnfAdapterUrl","http://localhost:18080/vnfs/rest/v1/vnfs/6d2e2469-8708-47c3-a0d4-73fa28a8a50b/vf-modules") } - + def rollbackReq = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> @@ -97,7 +97,7 @@ public class VnfAdapterRestV1Test { <notificationUrl>http://localhost:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa</notificationUrl> </rollbackVolumeGroupRequest> """ - + @Test public void testGetVolumeGroupId() { Node root = new XmlParser().parseText(rollbackReq) @@ -106,13 +106,29 @@ public class VnfAdapterRestV1Test { assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) } - + @Test public void testGetMessageId() { Node root = new XmlParser().parseText(rollbackReq) - + VnfAdapterRestV1 p = new VnfAdapterRestV1() def messageId = p.getMessageIdForVolumeGroupRollback(root) assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) } + + @Test + public void testProcessCallback() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfAdapterCallback.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("VNFAResponse_MESSAGE")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + vnfAdapterRestV1.processCallback(mockExecution) + + verify(mockExecution).setVariable("testProcessKeyResponse" ,sdncAdapterWorkflowRequest) + + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index 0398c87d69..d5b5cde99b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -290,7 +290,7 @@ public class BuildingBlockTestDataSetup{ customer.setSubscriberType("testSubscriberType" + customerCounter); customer.setServiceSubscription(buildServiceSubscription()); - + return customer; } @@ -341,50 +341,50 @@ public class BuildingBlockTestDataSetup{ customer.setServiceSubscription(buildServiceSubscription()); gBBInput.setCustomer(customer); - + return customer; } - + public Collection setCollection() { Collection collection = new Collection(); collection.setId("testId"); - + ServiceInstance serviceInstance = null; - + try { serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } - + serviceInstance.setCollection(collection); - + return collection; } - + public InstanceGroup setInstanceGroup() { InstanceGroup instanceGroup = new InstanceGroup(); instanceGroup.setId("testId"); instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); - + Collection collection = null; - + try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); collection = serviceInstance.getCollection(); - + if (collection == null) { collection = setCollection(); } } catch(BBObjectNotFoundException e) { collection = setCollection(); } - + collection.setInstanceGroup(instanceGroup); - + return instanceGroup; } - + public VpnBinding buildVpnBinding() { vpnBindingCounter++; @@ -664,12 +664,12 @@ public class BuildingBlockTestDataSetup{ modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier); modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier); modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier); - + ar.setModelInfoAllottedResource(modelInfo); - + return ar; } - + public Configuration setConfiguration () { Configuration config = new Configuration(); config.setConfigurationId("testConfigurationId"); @@ -679,7 +679,7 @@ public class BuildingBlockTestDataSetup{ modelInfoConfig.setModelInvariantId("modelInvariantId"); modelInfoConfig.setPolicyName("policyName"); config.setModelInfoConfiguration(modelInfoConfig); - + List<Configuration> configurations = new ArrayList<>(); configurations.add(config); ServiceInstance serviceInstance = new ServiceInstance(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java index 9b5bb33bf8..8515307394 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -141,7 +142,9 @@ public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer { e1.printStackTrace(); } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java index 8c34b65c00..f129164b4c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -131,7 +132,9 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { } LOGGER.debug("Sending callback response:" + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { LOGGER.debug("Exception :",e); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index f53fd6f424..832caae803 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -122,7 +123,9 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio } LOGGER.debug("Sending callback response to url: " + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); Response response = client.post(payLoad); LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); } catch (Exception e) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java index 63abf4d064..e190535e7e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -152,7 +153,9 @@ public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer { } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java index de21d64863..107a70d1d0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -131,7 +132,9 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform } LOGGER.debug("Sending callback response to url: " + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); Response response = client.post(payLoad); LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); //System.err.println("Successfully posted callback:" + result.getStatus()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java index 99ad84dad4..cf0f966414 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -132,7 +133,9 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java index 7ad687a2b3..5eaa4e75b0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -148,7 +149,9 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { LOGGER.debug("Exception :",e); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 560915d1f1..06f2fb7d5f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -133,7 +134,9 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { System.out.println("catch error in - request.post() "); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 9e8927102a..9e60e87644 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -133,7 +134,9 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { System.out.println("catch error in - request.post() "); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index e32362d1b0..78238f0271 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -40,6 +40,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; @@ -84,6 +85,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.constants.Defaults; @@ -99,6 +101,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; @@ -128,6 +131,9 @@ public class BBInputSetupTest { @Mock private BBInputSetupUtils SPY_bbInputSetupUtils; + @Mock + private CloudInfoFromAAI SPY_cloudInfoFromAAI; + @Spy private BBInputSetupMapperLayer bbInputSetupMapperLayer; @@ -135,8 +141,33 @@ public class BBInputSetupTest { public void setup(){ SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils); SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer); + SPY_bbInputSetup.setCloudInfoFromAAI(SPY_cloudInfoFromAAI); } - + + @Test + public void testGetVolumeGroupIdRelatedToVfModule() { + String expected = "volumeGroupId"; + String modelCustomizationId = "modelCustomizationId"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId(modelCustomizationId); + String cloudOwner = "cloudOwner"; + String cloudRegionId = "cloudRegionId"; + String volumeGroupId = "volumeGroupId"; + GenericVnf vnf = new GenericVnf(); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(expected); + vnf.getVolumeGroups().add(volumeGroup); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, null); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); + aaiVolumeGroup.setModelCustomizationId(modelCustomizationId); + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudOwner, cloudRegionId, volumeGroupId); + + Optional<String> actual = SPY_bbInputSetup.getVolumeGroupIdRelatedToVfModule(vnf, modelInfo, cloudOwner, cloudRegionId, lookupKeyMap); + + assertEquals(expected, actual.get()); + } + @Test public void testGetAlaCarteServiceInstance() throws Exception { ServiceInstance expected = mapper.readValue( @@ -1203,6 +1234,31 @@ public class BBInputSetupTest { } @Test + public void testMapVnfcCollectionInstanceGroup() { + VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class); + GenericVnf genericVnf = new GenericVnf(); + ModelInfo modelInfo = Mockito.mock(ModelInfo.class); + Service service = Mockito.mock(Service.class); + List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>(); + VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization(); + vnfcInstanceGroupCust.setModelUUID("modelUUID"); + vnfcInstanceGroupCust.setFunction("function"); + vnfcInstanceGroupCust.setDescription("description"); + vnfcInstanceGroups.add(vnfcInstanceGroupCust); + org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + instanceGroup.setModelUUID("modelUUID"); + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setModelUUID("modelUUID"); + doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service); + doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations(); + doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID"); + doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null, instanceGroup); + + SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); + + assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1); + } + @Test public void testPopulateGenericVnfWhereVnfTypeIsNull() throws JsonParseException, JsonMappingException, IOException { org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); @@ -1258,12 +1314,11 @@ public class BBInputSetupTest { doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); } @Test @@ -1688,8 +1743,10 @@ public class BBInputSetupTest { configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); executeBB.setConfigurationResourceKeys(configResourceKeys); + + executeBB.setRequestDetails(requestDetails); doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); @@ -1698,6 +1755,7 @@ public class BBInputSetupTest { doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); @@ -1806,8 +1864,9 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); @@ -1832,9 +1891,7 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; - doReturn(null).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); - + executeBB.getBuildingBlock().setBpmnFlowName("Network"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); @@ -1861,8 +1918,11 @@ public class BBInputSetupTest { String vnfType = null; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; + + + executeBB.setRequestDetails(requestDetails); doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); @@ -1922,8 +1982,10 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; + + executeBB.setRequestDetails(requestDetails); doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); @@ -1984,7 +2046,7 @@ public class BBInputSetupTest { Service service = Mockito.mock(Service.class); String requestAction = "deactivateInstance"; doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); String generatedId = "12131"; @@ -2027,8 +2089,9 @@ public class BBInputSetupTest { Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); List<NetworkResourceCustomization> networkCustList = new ArrayList<>(); @@ -2089,12 +2152,17 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "deleteInstance"; - doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); - doReturn(service).when(SPY_bbInputSetupUtils) - .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); - //doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); - + + executeBB.setRequestDetails(requestDetails); + ServiceInstance serviceInstance = gBB.getServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); + CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); requestDetails.setCloudConfiguration(cloudConfig); @@ -2104,37 +2172,37 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), - any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + any(String.class), isA(String.class), isA(CloudConfiguration.class)); requestAction = "activateInstance"; - doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); executeBB.getBuildingBlock().setBpmnFlowName("ActivateNetworkBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(2)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), - any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + any(String.class), isA(String.class), isA(CloudConfiguration.class)); requestAction = "unassignInstance"; - doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); executeBB.getBuildingBlock().setBpmnFlowName("UnassignNetworkBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(3)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), - any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + any(String.class), isA(String.class), isA(CloudConfiguration.class)); requestAction = "activateFabricConfiguration"; - doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-134534656234"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(4)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), - any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + any(String.class), isA(String.class), isA(CloudConfiguration.class)); } @@ -2160,7 +2228,7 @@ public class BBInputSetupTest { Service service = Mockito.mock(Service.class); String requestAction = "assignInstance"; doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, - requestAction, resourceId); + requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); String generatedId = "12131"; @@ -2188,6 +2256,7 @@ public class BBInputSetupTest { CloudConfiguration cloudConfiguration = new CloudConfiguration(); cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); String requestAction = "unassignInstance"; + executeBB.setRequestDetails(requestDetails); ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); @@ -2195,6 +2264,15 @@ public class BBInputSetupTest { configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); executeBB.setConfigurationResourceKeys(configResourceKeys); + ServiceInstance serviceInstance = gBB.getServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); + L3Network network = new L3Network(); network.setNetworkId("networkId"); gBB.getServiceInstance().getNetworks().add(network); @@ -2207,7 +2285,7 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null); verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class), any(Service.class)); @@ -2223,7 +2301,7 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName("ActivateVnfBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration); verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class)); @@ -2237,25 +2315,28 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName("UnassignVfModuleBB"); executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class)); verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class), any(Service.class), any(String.class)); - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setCloudOwner("CloudOwner"); + doReturn(Optional.of(cloudRegion)).when(SPY_cloudInfoFromAAI).getCloudInfoFromAAI(gBB.getServiceInstance()); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId"); gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); aaiVolumeGroup.setModelCustomizationId("modelCustId"); - doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(Defaults.CLOUD_OWNER.toString(), - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null); verify(SPY_bbInputSetup, times(3)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class)); verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(isA(VolumeGroup.class), isA(ModelInfo.class), @@ -2272,7 +2353,7 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class), any(Service.class), isA(ConfigurationResourceKeys.class)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java new file mode 100644 index 0000000000..ccaa97b735 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java @@ -0,0 +1,142 @@ +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class CloudInfoFromAAITest { + + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + @Spy + private CloudInfoFromAAI SPY_CloudInfoFromAAI = new CloudInfoFromAAI(); + + protected ObjectMapper mapper = new ObjectMapper(); + + @Mock + private BBInputSetupUtils SPY_bbInputSetupUtils; + + @Before + public void setup(){ + SPY_CloudInfoFromAAI.setBbInputSetupUtils(SPY_bbInputSetupUtils); + } + + @Test + public void testGetCloudInfoFromAAI() throws JsonParseException, JsonMappingException, IOException { + //Test vnfs + ServiceInstance serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + CloudRegion expected = new CloudRegion(); + GenericVnf vnf = new GenericVnf(); + String vnfId = "vnfId"; + vnf.setVnfId(vnfId); + serviceInstance.getVnfs().add(vnf); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setVnfId(vnfId); + Relationships relationships = Mockito.mock(Relationships.class); + Optional<Relationships> relationshipsOp= Optional.of(relationships); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doReturn(relationshipsOp).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class)); + doReturn(Optional.of(expected)).when(SPY_CloudInfoFromAAI).getRelatedCloudRegionAndTenant(relationships); + Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + assertThat(actual.get(), sameBeanAs(expected)); + + //Test networks + serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + L3Network l3Network = new L3Network(); + String networkId = "networkId"; + l3Network.setNetworkId(networkId); + serviceInstance.getNetworks().add(l3Network); + org.onap.aai.domain.yang.L3Network aaiL3Network = new org.onap.aai.domain.yang.L3Network(); + aaiL3Network.setNetworkId(networkId); + doReturn(aaiL3Network).when(SPY_bbInputSetupUtils).getAAIL3Network(l3Network.getNetworkId()); + actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + assertThat(actual.get(), sameBeanAs(expected)); + + //Test no relationships + + doReturn(Optional.empty()).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class)); + actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + assertEquals(actual, Optional.empty()); + + //Test null + serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + assertEquals(actual, Optional.empty()); + } + + @Test + public void testGetRelatedCloudRegionAndTenant() throws JsonProcessingException { + String cloudOwner = "cloudOwner"; + String cloudRegionId = "cloudRegionId"; + String cloudRegionVersion = "cloudRegionVersion"; + String cloudRegionComplexName = "cloudRegionComplexName"; + String tenantId = "tenantId"; + CloudRegion expected = new CloudRegion(); + expected.setCloudOwner(cloudOwner); + expected.setCloudRegionVersion(cloudRegionVersion); + expected.setComplex(cloudRegionComplexName); + expected.setLcpCloudRegionId(cloudRegionId); + expected.setTenantId(tenantId); + + Relationships relationships = Mockito.mock(Relationships.class); + List<AAIResultWrapper> cloudRegions = new ArrayList<>(); + org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + cloudRegion.setCloudOwner(cloudOwner); + cloudRegion.setCloudRegionId(cloudRegionId); + cloudRegion.setCloudRegionVersion(cloudRegionVersion); + cloudRegion.setComplexName(cloudRegionComplexName); + AAIResultWrapper cloudRegionWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion)); + cloudRegions.add(cloudRegionWrapper); + + doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION); + List<AAIResultWrapper> tenants = new ArrayList<>(); + org.onap.aai.domain.yang.Tenant tenant = new org.onap.aai.domain.yang.Tenant(); + tenant.setTenantId(tenantId); + AAIResultWrapper tenantWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(tenant)); + tenants.add(tenantWrapper); + doReturn(tenants).when(relationships).getByType(AAIObjectType.TENANT); + + Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships); + + assertThat(actual.get(), sameBeanAs(expected)); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index fc2de4307b..9af9b2f2c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -91,7 +91,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); - delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -113,6 +115,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode(ASTERISK); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -136,7 +140,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); - + delegateExecution.setVariable("suppressRollback", false); + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); assertEquals("Abort", delegateExecution.getVariable("handlingCode")); @@ -147,6 +152,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); delegateExecution.setVariable("aLaCarte", true); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); + delegateExecution.setVariable("suppressRollback", false); assertEquals("Abort", delegateExecution.getVariable("handlingCode")); } @@ -157,6 +163,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -180,6 +187,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", false); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -203,6 +211,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -220,4 +229,12 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode")); } + @Test + public void suppressRollbackTest() throws Exception { + delegateExecution.setVariable("suppressRollback", true); + delegateExecution.setVariable("aLaCarte", true); + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml new file mode 100644 index 0000000000..d63a5ecbaf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml @@ -0,0 +1,21 @@ + + +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<createVfModuleResponse> + <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> + <rollback> + <cloudSiteId>mtwnj1a</cloudSiteId> + <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> + <msoRequest/> + <tenantId>c2141e3fcae940fcb4797ec9115e5a7a</tenantId> + <vfModuleCreated>true</vfModuleCreated> + <vfModuleId>b70a3ba5-d172-4e9e-98f6-39516446b25b</vfModuleId> + <vfModuleStackId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vfModuleStackId> + <vnfId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vnfId> + </rollback> + <vfModuleCreated>true</vfModuleCreated> + <vfModuleId>b70a3ba5-d172-4e9e-98f6-39516446b25b</vfModuleId> + <vfModuleOutputs/> + <vfModuleStackId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vfModuleStackId> + <vnfId>e64e62e1-7c02-4148-ad9c-e51406da508a</vnfId> +</createVfModuleResponse>
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java index 750cd241e8..5100085020 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java @@ -87,6 +87,20 @@ public class UrnPropertiesReader { } } + /** + * Return the String array URN property value from the environment object + * @param variableName URN property name + * @return URN property value + */ + + public static String[] getVariablesArray(String variableName){ + if (environment != null) { + return environment.getProperty(variableName, String[].class); + } else { + return null; + } + } + public static String getVariable(String variableName, String defaultValue) { return Optional.ofNullable(getVariable(variableName)).orElse(defaultValue); } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java index bb50597c31..d021394731 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java @@ -27,9 +27,9 @@ public class CompareModelsResult extends JsonWrapper implements Serializable { private static final long serialVersionUID = 1L; - List<ResourceModelInfo> addedResourceList; - List<ResourceModelInfo> deletedResourceList; - List<String> requestInputs; + private List<ResourceModelInfo> addedResourceList; + private List<ResourceModelInfo> deletedResourceList; + private List<String> requestInputs; public List<ResourceModelInfo> getAddedResourceList() { return addedResourceList; diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index e22125bee6..fb5d0108ba 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -249,12 +249,12 @@ <artifactId>camunda-bpm-assert</artifactId> <version>2.0-alpha2</version> <scope>test</scope> - </dependency> + </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>1.7.0</version> - <scope>test</scope> - </dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>1.7.0</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 335f3468a7..d24e953196 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -56,6 +56,7 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.camunda.bpm.engine.history.HistoricVariableInstance; import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.runtime.ProcessInstanceQuery; import org.camunda.bpm.engine.test.ProcessEngineRule; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.custommonkey.xmlunit.DetailedDiff; @@ -884,13 +885,23 @@ public abstract class WorkflowTest { return null; } + ProcessInstanceQuery processInstanceQuery = null; if (processInstance == null) { - processInstance = runtimeService + processInstanceQuery = runtimeService .createProcessInstanceQuery() - .processDefinitionKey(processKey) - .singleResult(); + .processDefinitionKey(processKey); + } + + if(processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0){ + processInstance = processInstanceQuery.singleResult(); + }else{ + //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list + msoLogger.debug("Process Instance Query returned " + processInstanceQuery.count() + " instance. Getting the last instance in the list"); + List<ProcessInstance> processList = processInstanceQuery.list(); + processInstance = processList.get((processList.size() - 1)); } + if (processInstance != null) { value = runtimeService .getVariable(processInstance.getId(), variable); @@ -927,7 +938,7 @@ public abstract class WorkflowTest { protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) { String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", "SDNCAResponse_CORRELATOR", timeout); - + if (sdncRequestId == null) { sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2", "SDNCAResponse_CORRELATOR", timeout); @@ -1693,7 +1704,7 @@ public abstract class WorkflowTest { /** * Checks to see if the specified process is ended. - * + * * @param processInstanceId the process Instance Id * @return true if the process is ended */ @@ -1705,7 +1716,7 @@ public abstract class WorkflowTest { /** * Checks to see if the specified process is ended. - * + * * @author cb645j */ //TODO combine into 1 diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 74e5a6c964..2d0d4b51a9 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -22,10 +24,12 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.HashMap; import java.util.Map; +import java.util.UUID; import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -35,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { private static final String TIMEOUT_10_S = "PT10S"; + private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); @Autowired private AaiConnectionTestImpl aaiConnection; @@ -49,6 +54,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { Map<String, Object> variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY); + variables.put(PNF_UUID, VALID_UUID); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -76,6 +82,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { Map<String, Object> variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY); + variables.put(PNF_UUID, VALID_UUID); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -88,7 +95,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { "CheckInputs", "CheckAiiForCorrelationId", "DoesAaiContainInfoAboutPnf", - "CreateAndActivatePnf_CreateAaiEntry", + "CreatePnfEntryInAai", "AaiEntryExists", "InformDmaapClient", "WaitForDmaapPnfReadyNotification", diff --git a/bpmn/pom.xml b/bpmn/pom.xml index a7b49bc52a..e28bedda99 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -64,7 +64,13 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> + <version>3.11.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.camunda.bpm.extension.mockito</groupId> + <artifactId>camunda-bpm-mockito</artifactId> + <version>4.0.0</version> <scope>test</scope> </dependency> </dependencies> diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index 8f1f2bf56e..4fe02ee3ac 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -107,6 +107,12 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>1.7.0</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn index dc6e4a8d94..78a389a67d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.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.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ActivateNetworkBB" name="ActivateNetworkBB" isExecutable="true"> <bpmn2:startEvent id="activateNetwork_startEvent"> <bpmn2:outgoing>SequenceFlow_05elmhj</bpmn2:outgoing> @@ -9,15 +9,24 @@ </bpmn2:endEvent> <bpmn2:serviceTask id="Activate_Network_SDNC_ServiceTask" name=" SDNC Activate (network) " camunda:expression="${SDNCActivateTasks.activateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05elmhj</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0xbvwsu</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0zzlwi7</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="Activate_Network_AAI_ServiceTask" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0xbvwsu</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0wb238v</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18atf08</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_05elmhj" sourceRef="activateNetwork_startEvent" targetRef="Activate_Network_SDNC_ServiceTask" /> - <bpmn2:sequenceFlow id="SequenceFlow_0xbvwsu" sourceRef="Activate_Network_SDNC_ServiceTask" targetRef="Activate_Network_AAI_ServiceTask" /> <bpmn2:sequenceFlow id="SequenceFlow_18atf08" sourceRef="Activate_Network_AAI_ServiceTask" targetRef="activateNetwork_EndEvent" /> + <bpmn2:callActivity id="CallActivity_sdncHandler" name="SDNC Activate (network)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0zzlwi7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0wb238v</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0zzlwi7" sourceRef="Activate_Network_SDNC_ServiceTask" targetRef="CallActivity_sdncHandler" /> + <bpmn2:sequenceFlow id="SequenceFlow_0wb238v" sourceRef="CallActivity_sdncHandler" targetRef="Activate_Network_AAI_ServiceTask" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -30,16 +39,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="activateNetwork_EndEvent"> - <dc:Bounds x="975" y="-55" width="36" height="36" /> + <dc:Bounds x="1115" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="971" y="-19" width="46" height="12" /> + <dc:Bounds x="1089" y="-19" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1k7d8ih_di" bpmnElement="Activate_Network_SDNC_ServiceTask"> <dc:Bounds x="653" y="-77" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1911vum_di" bpmnElement="Activate_Network_AAI_ServiceTask"> - <dc:Bounds x="802" y="-77" width="100" height="80" /> + <dc:Bounds x="969" y="-77" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05elmhj_di" bpmnElement="SequenceFlow_05elmhj"> <di:waypoint xsi:type="dc:Point" x="581" y="-37" /> @@ -48,22 +57,28 @@ <dc:Bounds x="617" y="-62" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xbvwsu_di" bpmnElement="SequenceFlow_0xbvwsu"> + <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> + <di:waypoint xsi:type="dc:Point" x="1069" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="1115" y="-37" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1047" y="-52" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0g1zk8g_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="802" y="-77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zzlwi7_di" bpmnElement="SequenceFlow_0zzlwi7"> <di:waypoint xsi:type="dc:Point" x="753" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="778" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="778" y="-37" /> <di:waypoint xsi:type="dc:Point" x="802" y="-37" /> <bpmndi:BPMNLabel> - <dc:Bounds x="793" y="-37" width="0" height="0" /> + <dc:Bounds x="777.5" y="-58" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> + <bpmndi:BPMNEdge id="SequenceFlow_0wb238v_di" bpmnElement="SequenceFlow_0wb238v"> <di:waypoint xsi:type="dc:Point" x="902" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="939" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="939" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="975" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="969" y="-37" /> <bpmndi:BPMNLabel> - <dc:Bounds x="954" y="-37" width="0" height="0" /> + <dc:Bounds x="935.5" y="-58" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn index 47cd3cf30b..49dc9be58e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn @@ -62,4 +62,4 @@ </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index c7b7952f02..259a3341c2 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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: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.8.2"> <bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> @@ -10,14 +10,23 @@ </bpmn:endEvent> <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14kvrbe</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_14kvrbe" sourceRef="ActivateVfModule" targetRef="UpdateVfModuleActiveStatus" /> <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_14kvrbe</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1j4x1ej</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xsp0pv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0xsp0pv" sourceRef="UpdateVfModuleActiveStatus" targetRef="ActivateVfModuleBB_End" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Activate (vfModule)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1a495wm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j4x1ej</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1a495wm" sourceRef="ActivateVfModule" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_1j4x1ej" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleActiveStatus" /> </bpmn:process> <bpmn:error id="Error_0q258vt" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -30,35 +39,45 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="288" y="120" /> + <di:waypoint xsi:type="dc:Point" x="262" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="203.5" y="99" width="90" height="12" /> + <dc:Bounds x="190.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="624" y="102" width="36" height="36" /> + <dc:Bounds x="736" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="142" width="19" height="12" /> + <dc:Bounds x="710" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="288" y="80" width="100" height="80" /> + <dc:Bounds x="262" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_14kvrbe_di" bpmnElement="SequenceFlow_14kvrbe"> - <di:waypoint xsi:type="dc:Point" x="388" y="120" /> - <di:waypoint xsi:type="dc:Point" x="433" y="120" /> + <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> + <dc:Bounds x="600" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> + <di:waypoint xsi:type="dc:Point" x="700" y="120" /> + <di:waypoint xsi:type="dc:Point" x="736" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="365.5" y="99" width="90" height="12" /> + <dc:Bounds x="673" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="433" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="420" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="533" y="120" /> - <di:waypoint xsi:type="dc:Point" x="624" y="120" /> + <bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm"> + <di:waypoint xsi:type="dc:Point" x="362" y="120" /> + <di:waypoint xsi:type="dc:Point" x="420" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> + <di:waypoint xsi:type="dc:Point" x="520" y="120" /> + <di:waypoint xsi:type="dc:Point" x="600" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="533.5" y="99" width="90" height="12" /> + <dc:Bounds x="560" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn index 1147283160..e1f80dc77a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn @@ -1,23 +1,32 @@ <?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: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.8.2"> <bpmn:process id="ActivateVnfBB" name="ActivateVnfBB" isExecutable="true"> <bpmn:startEvent id="Start_ActivateVnfBB"> <bpmn:outgoing>SequenceFlow_0k9qnoi</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0k9qnoi" sourceRef="Start_ActivateVnfBB" targetRef="Task_SDNCAdapterVnfTopologyActivate" /> - <bpmn:sequenceFlow id="SequenceFlow_0r6pzwt" sourceRef="Task_SDNCAdapterVnfTopologyActivate" targetRef="Task_ActivateOrchestrationStatusVnf" /> <bpmn:endEvent id="End_ActivateVnfBB"> <bpmn:incoming>SequenceFlow_0vnitwg</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0vnitwg" sourceRef="Task_ActivateOrchestrationStatusVnf" targetRef="End_ActivateVnfBB" /> <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyActivate" name=" SDNC Activate (vnf) " camunda:expression="${SDNCActivateTasks.activateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0k9qnoi</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0r6pzwt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0wk5e4o</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_ActivateOrchestrationStatusVnf" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0r6pzwt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ho00ja</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0vnitwg</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Activate (vnf)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0wk5e4o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ho00ja</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0wk5e4o" sourceRef="Task_SDNCAdapterVnfTopologyActivate" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_0ho00ja" sourceRef="CallActivity_sdncHandler" targetRef="Task_ActivateOrchestrationStatusVnf" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVnfBB"> @@ -34,32 +43,42 @@ <dc:Bounds x="199" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0r6pzwt_di" bpmnElement="SequenceFlow_0r6pzwt"> - <di:waypoint xsi:type="dc:Point" x="379" y="120" /> - <di:waypoint xsi:type="dc:Point" x="411" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="350" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1ad7eym_di" bpmnElement="End_ActivateVnfBB"> - <dc:Bounds x="580" y="102" width="36" height="36" /> + <dc:Bounds x="726" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="589" y="142" width="18" height="12" /> + <dc:Bounds x="699" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vnitwg_di" bpmnElement="SequenceFlow_0vnitwg"> - <di:waypoint xsi:type="dc:Point" x="511" y="120" /> - <di:waypoint xsi:type="dc:Point" x="580" y="120" /> + <di:waypoint xsi:type="dc:Point" x="663" y="120" /> + <di:waypoint xsi:type="dc:Point" x="726" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="500.5" y="99" width="90" height="12" /> + <dc:Bounds x="649.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1k98q3r_di" bpmnElement="Task_SDNCAdapterVnfTopologyActivate"> <dc:Bounds x="279" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1vg25fs_di" bpmnElement="Task_ActivateOrchestrationStatusVnf"> - <dc:Bounds x="411" y="80" width="100" height="80" /> + <dc:Bounds x="563" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1j8aadu_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="418" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0wk5e4o_di" bpmnElement="SequenceFlow_0wk5e4o"> + <di:waypoint xsi:type="dc:Point" x="379" y="120" /> + <di:waypoint xsi:type="dc:Point" x="418" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="398.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ho00ja_di" bpmnElement="SequenceFlow_0ho00ja"> + <di:waypoint xsi:type="dc:Point" x="518" y="120" /> + <di:waypoint xsi:type="dc:Point" x="563" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn index 5f7b29b3ab..967e01885c 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.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.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="AssignNetworkBB" name="AssignNetworkBB" isExecutable="true"> <bpmn2:startEvent id="AssignNetworkBB_start"> <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing> @@ -10,14 +10,14 @@ </bpmn2:serviceTask> <bpmn2:serviceTask id="ServiceTask_assign_network_sdnc" name=" SDNC Assign (network) " camunda:expression="${SDNCAssignTasks.assignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_16hhbw3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0oawye1</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0rt36co</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="ServiceTask_put_network_in_AAI" name=" AAI Create (network) " camunda:expression="${AAICreateTasks.createNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0gkr871</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1ctpnpe</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="ServiceTask_assign_network_aai" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0oawye1</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1mvf7b9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0988gld</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ExclusiveGateway_0vtj8n8"> @@ -61,8 +61,17 @@ </bpmn2:inclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0jm95hf" sourceRef="ExclusiveGateway_0vtj8n8" targetRef="ServiceTask_get_cloud_region" /> <bpmn2:sequenceFlow id="SequenceFlow_16hhbw3" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" /> - <bpmn2:sequenceFlow id="SequenceFlow_0oawye1" sourceRef="ServiceTask_assign_network_sdnc" targetRef="ServiceTask_assign_network_aai" /> <bpmn2:sequenceFlow id="SequenceFlow_0988gld" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> + <bpmn2:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Assign (network)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0rt36co</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1mvf7b9</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0rt36co" sourceRef="ServiceTask_assign_network_sdnc" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn2:sequenceFlow id="SequenceFlow_1mvf7b9" sourceRef="CallActivity_sdncHandlerCall" targetRef="ServiceTask_assign_network_aai" /> <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> </bpmn2:textAnnotation> <bpmn2:association id="Association_1rsqd3z" sourceRef="ServiceTask_get_cloud_region" targetRef="TextAnnotation_0dnksb2" /> @@ -97,7 +106,7 @@ <dc:Bounds x="906" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai"> - <dc:Bounds x="1909" y="-127" width="100" height="80" /> + <dc:Bounds x="2106" y="-127" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q"> <di:waypoint xsi:type="dc:Point" x="863" y="-112" /> @@ -117,9 +126,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end"> - <dc:Bounds x="2118" y="-105" width="36" height="36" /> + <dc:Bounds x="2241" y="-105" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2113" y="-65" width="46" height="12" /> + <dc:Bounds x="2214" y="-65" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih"> @@ -210,18 +219,28 @@ <dc:Bounds x="1750.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0oawye1_di" bpmnElement="SequenceFlow_0oawye1"> + <bpmndi:BPMNEdge id="SequenceFlow_0988gld_di" bpmnElement="SequenceFlow_0988gld"> + <di:waypoint xsi:type="dc:Point" x="2206" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="2241" y="-87" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2178.5" y="-108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0h7upeg_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="1927" y="-127" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rt36co_di" bpmnElement="SequenceFlow_0rt36co"> <di:waypoint xsi:type="dc:Point" x="1869" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1909" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="1927" y="-87" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1889" y="-108" width="0" height="12" /> + <dc:Bounds x="1898" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0988gld_di" bpmnElement="SequenceFlow_0988gld"> - <di:waypoint xsi:type="dc:Point" x="2009" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="2118" y="-87" /> + <bpmndi:BPMNEdge id="SequenceFlow_1mvf7b9_di" bpmnElement="SequenceFlow_1mvf7b9"> + <di:waypoint xsi:type="dc:Point" x="2027" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="2106" y="-87" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2063.5" y="-108" width="0" height="12" /> + <dc:Bounds x="2066.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn index d1f2286258..a98db3ac7b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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: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.8.2"> <bpmn:process id="AssignServiceInstanceBB" name="AssignServiceInstanceBB" isExecutable="true"> <bpmn:startEvent id="Start_AssignServiceInstanceBB"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -16,20 +16,19 @@ <bpmn:incoming>SequenceFlow_1t55i01</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0aef1l8</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_AssignServiceInstance" name=" SDNC Assign (svc instance) " camunda:expression="${SDNCAssignTasks.assignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_AssignServiceInstance" name=" SDNC Create Assign Request (svc instance) " camunda:expression="${SDNCAssignTasks.assignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0aef1l8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07ea5ui</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1vmf5yv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="Start_AssignServiceInstanceBB" targetRef="Task_CreateServiceSubscription" /> <bpmn:sequenceFlow id="SequenceFlow_0czewtx" sourceRef="Task_CreateServiceInstance" targetRef="Task_CreateProject" /> <bpmn:sequenceFlow id="SequenceFlow_1t55i01" sourceRef="Task_CreateProject" targetRef="Task_CreateOwningEntity" /> - <bpmn:sequenceFlow id="SequenceFlow_07ea5ui" sourceRef="Task_AssignServiceInstance" targetRef="Task_UpdateServiceOstatusToAssigned" /> <bpmn:endEvent id="End_AssignServiceInstanceBB"> <bpmn:incoming>SequenceFlow_14xl505</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_14xl505" sourceRef="Task_UpdateServiceOstatusToAssigned" targetRef="End_AssignServiceInstanceBB" /> <bpmn:serviceTask id="Task_UpdateServiceOstatusToAssigned" name=" AAI Update (svc instance) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_07ea5ui</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0c6u1cp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14xl505</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1h6t7yr" sourceRef="Task_CreateServiceSubscription" targetRef="Task_CreateServiceInstance" /> @@ -38,6 +37,16 @@ <bpmn:outgoing>SequenceFlow_1h6t7yr</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0aef1l8" sourceRef="Task_CreateOwningEntity" targetRef="Task_AssignServiceInstance" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Assign (svc instance)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1vmf5yv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c6u1cp</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1vmf5yv" sourceRef="Task_AssignServiceInstance" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_0c6u1cp" sourceRef="CallActivity_sdncHandler" targetRef="Task_UpdateServiceOstatusToAssigned" /> </bpmn:process> <bpmn:error id="Error_02g61p6" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -81,28 +90,21 @@ <dc:Bounds x="464" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07ea5ui_di" bpmnElement="SequenceFlow_07ea5ui"> - <di:waypoint xsi:type="dc:Point" x="819" y="108" /> - <di:waypoint xsi:type="dc:Point" x="869" y="108" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="799" y="87" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="End_AssignServiceInstanceBB"> - <dc:Bounds x="1030" y="90" width="36" height="36" /> + <dc:Bounds x="1150" y="90" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1039" y="130" width="18" height="12" /> + <dc:Bounds x="1123" y="130" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14xl505_di" bpmnElement="SequenceFlow_14xl505"> - <di:waypoint xsi:type="dc:Point" x="969" y="108" /> - <di:waypoint xsi:type="dc:Point" x="1030" y="108" /> + <di:waypoint xsi:type="dc:Point" x="1104" y="108" /> + <di:waypoint xsi:type="dc:Point" x="1150" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="954.5" y="87" width="90" height="12" /> + <dc:Bounds x="1082" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="Task_UpdateServiceOstatusToAssigned"> - <dc:Bounds x="869" y="68" width="100" height="80" /> + <dc:Bounds x="1004" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1h6t7yr_di" bpmnElement="SequenceFlow_1h6t7yr"> <di:waypoint xsi:type="dc:Point" x="253" y="108" /> @@ -121,6 +123,23 @@ <dc:Bounds x="653" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_037c9st_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="862" y="68" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1vmf5yv_di" bpmnElement="SequenceFlow_1vmf5yv"> + <di:waypoint xsi:type="dc:Point" x="819" y="108" /> + <di:waypoint xsi:type="dc:Point" x="862" y="108" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="840.5" y="87" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0c6u1cp_di" bpmnElement="SequenceFlow_0c6u1cp"> + <di:waypoint xsi:type="dc:Point" x="962" y="108" /> + <di:waypoint xsi:type="dc:Point" x="1004" y="108" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="983" y="87" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn index 3ab34c4129..7dee0f709d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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.4.0"> +<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.8.2"> <bpmn:process id="AssignVfModuleBB" name="AssignVfModuleBB" isExecutable="true"> <bpmn:startEvent id="AssignVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -10,7 +10,7 @@ </bpmn:serviceTask> <bpmn:serviceTask id="AssignVfModule" name=" SDNC Assign (vf module) " camunda:expression="${SDNCAssignTasks.assignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0574gaa</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15hn8si</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0269euz</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="AssignVfModuleBB_Start" targetRef="CreateVfModule" /> <bpmn:sequenceFlow id="SequenceFlow_0czewtx" sourceRef="CreateVfModule" targetRef="ConnectVfModuleToVolumeGroup" /> @@ -19,15 +19,24 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_14xl505" sourceRef="UpdateVfModuleStatus" targetRef="AssignVfModuleBB_End" /> <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_15hn8si</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1dttbxh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14xl505</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_15hn8si" sourceRef="AssignVfModule" targetRef="UpdateVfModuleStatus" /> <bpmn:sequenceFlow id="SequenceFlow_0574gaa" sourceRef="ConnectVfModuleToVolumeGroup" targetRef="AssignVfModule" /> <bpmn:serviceTask id="ConnectVfModuleToVolumeGroup" name=" AAI Connect (volume) " camunda:expression="${AAICreateTasks.connectVfModuleToVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0czewtx</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0574gaa</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Activate (vfModule)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0269euz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1dttbxh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0269euz" sourceRef="AssignVfModule" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn:sequenceFlow id="SequenceFlow_1dttbxh" sourceRef="CallActivity_sdncHandlerCall" targetRef="UpdateVfModuleStatus" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignVfModuleBB"> @@ -38,23 +47,23 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="CreateVfModule"> - <dc:Bounds x="297" y="46" width="100" height="80" /> + <dc:Bounds x="255" y="46" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="AssignVfModule"> - <dc:Bounds x="632" y="46" width="100" height="80" /> + <dc:Bounds x="540" y="46" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> <di:waypoint xsi:type="dc:Point" x="220" y="86" /> - <di:waypoint xsi:type="dc:Point" x="297" y="86" /> + <di:waypoint xsi:type="dc:Point" x="255" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="214" y="71" width="90" height="0" /> + <dc:Bounds x="192.5" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0czewtx_di" bpmnElement="SequenceFlow_0czewtx"> - <di:waypoint xsi:type="dc:Point" x="397" y="86" /> - <di:waypoint xsi:type="dc:Point" x="461" y="86" /> + <di:waypoint xsi:type="dc:Point" x="355" y="86" /> + <di:waypoint xsi:type="dc:Point" x="400" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="384" y="71" width="90" height="0" /> + <dc:Bounds x="332.5" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="AssignVfModuleBB_End"> @@ -64,32 +73,42 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14xl505_di" bpmnElement="SequenceFlow_14xl505"> - <di:waypoint xsi:type="dc:Point" x="906" y="86" /> + <di:waypoint xsi:type="dc:Point" x="964" y="86" /> <di:waypoint xsi:type="dc:Point" x="1008" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="912" y="71" width="90" height="0" /> + <dc:Bounds x="941" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="806" y="46" width="100" height="80" /> + <dc:Bounds x="864" y="46" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15hn8si_di" bpmnElement="SequenceFlow_15hn8si"> - <di:waypoint xsi:type="dc:Point" x="732" y="86" /> - <di:waypoint xsi:type="dc:Point" x="806" y="86" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="724" y="71" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0574gaa_di" bpmnElement="SequenceFlow_0574gaa"> - <di:waypoint xsi:type="dc:Point" x="561" y="86" /> - <di:waypoint xsi:type="dc:Point" x="632" y="86" /> + <di:waypoint xsi:type="dc:Point" x="500" y="86" /> + <di:waypoint xsi:type="dc:Point" x="540" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="552" y="71" width="90" height="0" /> + <dc:Bounds x="475" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0ekqpfn_di" bpmnElement="ConnectVfModuleToVolumeGroup"> - <dc:Bounds x="461" y="46" width="100" height="80" /> + <dc:Bounds x="400" y="46" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0uicgnt_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="701" y="46" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0269euz_di" bpmnElement="SequenceFlow_0269euz"> + <di:waypoint xsi:type="dc:Point" x="640" y="86" /> + <di:waypoint xsi:type="dc:Point" x="701" y="86" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="670.5" y="65" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1dttbxh_di" bpmnElement="SequenceFlow_1dttbxh"> + <di:waypoint xsi:type="dc:Point" x="801" y="86" /> + <di:waypoint xsi:type="dc:Point" x="864" y="86" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="832.5" y="65" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index 0a067483ff..f4db92ba5c 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -13,7 +13,7 @@ </bpmn:endEvent> <bpmn:serviceTask id="Task_CreateVnf" name=" AAI Create (vnf) " camunda:expression="${AAICreateTasks.createVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0qj7zcn</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_AssignVnfBB" targetRef="Task_CreateVnf" /> <bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_UpdateVnfOrchestrationStatusAssigned" targetRef="End_AssignVnfBB" /> @@ -25,7 +25,6 @@ <bpmn:incoming>SequenceFlow_1lppa2m</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1nle8kc</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="Task_CreateVnf" targetRef="Task_createPlatform" /> <bpmn:sequenceFlow id="SequenceFlow_1nle8kc" sourceRef="Task_createInstanceGroups" targetRef="ExclusiveGateway_02tchpp" /> <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g" /> <bpmn:sequenceFlow id="SequenceFlow_1uiok7v" name="yes" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_callHoming"> @@ -45,7 +44,7 @@ <bpmn:sequenceFlow id="SequenceFlow_169g0ir" sourceRef="Task_createPlatform" targetRef="Task_createLineOfBusiness" /> <bpmn:sequenceFlow id="SequenceFlow_1lppa2m" sourceRef="Task_createLineOfBusiness" targetRef="Task_createInstanceGroups" /> <bpmn:serviceTask id="Task_createPlatform" name=" AAI Connect (platform) " camunda:expression="${AAICreateTasks.createPlatform(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> + <bpmn:incoming>SequenceFlow_18ixm0j</bpmn:incoming> <bpmn:outgoing>SequenceFlow_169g0ir</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_createLineOfBusiness" name=" AAI Create (line bus) " camunda:expression="${AAICreateTasks.createLineOfBusiness(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -73,6 +72,17 @@ <bpmn:incoming>SequenceFlow_0v8d14a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1samncw</bpmn:outgoing> </bpmn:inclusiveGateway> + <bpmn:serviceTask id="ServiceTask_ConnectVnfToCloudRegion" name=" AAI Connect (vnf to cloud region) " camunda:expression="${AAICreateTasks.connectVnfToCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0qj7zcn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nsg48b</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0qj7zcn" sourceRef="Task_CreateVnf" targetRef="ServiceTask_ConnectVnfToCloudRegion" /> + <bpmn:serviceTask id="ServiceTask_ConnectVnfToTenant" name=" AAI Connect (vnf to tenant) " camunda:expression="${AAICreateTasks.connectVnfToTenant(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0nsg48b</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18ixm0j</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0nsg48b" sourceRef="ServiceTask_ConnectVnfToCloudRegion" targetRef="ServiceTask_ConnectVnfToTenant" /> + <bpmn:sequenceFlow id="SequenceFlow_18ixm0j" sourceRef="ServiceTask_ConnectVnfToTenant" targetRef="Task_createPlatform" /> <bpmn:callActivity id="CallActivity_sdncAssign" name="SDNC Assign (vnf)" calledElement="SDNCHandler"> <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> @@ -89,9 +99,9 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignVnfBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_AssignVnfBB"> - <dc:Bounds x="72" y="116" width="36" height="36" /> + <dc:Bounds x="-249" y="116" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="79" y="152" width="23" height="12" /> + <dc:Bounds x="-275" y="152" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SDNCAdapterVnfTopologyAssign"> @@ -104,13 +114,13 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="Task_CreateVnf"> - <dc:Bounds x="147" y="94" width="100" height="80" /> + <dc:Bounds x="-159" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="108" y="134" /> - <di:waypoint xsi:type="dc:Point" x="147" y="134" /> + <di:waypoint xsi:type="dc:Point" x="-213" y="134" /> + <di:waypoint xsi:type="dc:Point" x="-159" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="83" y="113" width="90" height="12" /> + <dc:Bounds x="-231" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0csh9dc_di" bpmnElement="SequenceFlow_0csh9dc"> @@ -126,13 +136,6 @@ <bpmndi:BPMNShape id="ServiceTask_0wjy7za_di" bpmnElement="Task_createInstanceGroups"> <dc:Bounds x="534" y="94" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> - <di:waypoint xsi:type="dc:Point" x="247" y="134" /> - <di:waypoint xsi:type="dc:Point" x="279" y="134" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="218" y="113" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nle8kc_di" bpmnElement="SequenceFlow_1nle8kc"> <di:waypoint xsi:type="dc:Point" x="634" y="134" /> <di:waypoint xsi:type="dc:Point" x="679" y="134" /> @@ -222,6 +225,33 @@ <dc:Bounds x="896" y="163" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0zx2c43_di" bpmnElement="ServiceTask_ConnectVnfToCloudRegion"> + <dc:Bounds x="-10" y="94" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0qj7zcn_di" bpmnElement="SequenceFlow_0qj7zcn"> + <di:waypoint xsi:type="dc:Point" x="-59" y="134" /> + <di:waypoint xsi:type="dc:Point" x="-10" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-34.5" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0y6itfu_di" bpmnElement="ServiceTask_ConnectVnfToTenant"> + <dc:Bounds x="140" y="94" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0nsg48b_di" bpmnElement="SequenceFlow_0nsg48b"> + <di:waypoint xsi:type="dc:Point" x="90" y="134" /> + <di:waypoint xsi:type="dc:Point" x="140" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="115" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18ixm0j_di" bpmnElement="SequenceFlow_18ixm0j"> + <di:waypoint xsi:type="dc:Point" x="240" y="134" /> + <di:waypoint xsi:type="dc:Point" x="279" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="259.5" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_12uxg1m_di" bpmnElement="CallActivity_sdncAssign"> <dc:Bounds x="1060" y="94" width="100" height="80" /> </bpmndi:BPMNShape> @@ -249,3 +279,4 @@ </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn index fa0c7f4f44..c2e960364c 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.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.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ChangeModelServiceInstanceBB" name="ChangeModelServiceInstanceBB" isExecutable="true"> <bpmn2:startEvent id="ChangeModelServiceInstance_Start"> <bpmn2:outgoing>SequenceFlow_18i4a05</bpmn2:outgoing> @@ -8,16 +8,25 @@ <bpmn2:incoming>SequenceFlow_0g502yj</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_18i4a05" sourceRef="ChangeModelServiceInstance_Start" targetRef="SDNCChangeModelServiceInstance" /> - <bpmn2:sequenceFlow id="SequenceFlow_19kfk17" sourceRef="SDNCChangeModelServiceInstance" targetRef="AAIUpdateModelServiceInstance" /> <bpmn2:sequenceFlow id="SequenceFlow_0g502yj" sourceRef="AAIUpdateModelServiceInstance" targetRef="ChangeModelServiceInstance_End" /> <bpmn2:serviceTask id="SDNCChangeModelServiceInstance" name=" SDNC Change (svc instance) " camunda:expression="${SDNCChangeAssignTasks.changeModelServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_18i4a05</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_19kfk17</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1q3rjt4</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="AAIUpdateModelServiceInstance" name=" AAI Update (svc Instance) " camunda:expression="${AAIUpdateTasks.updateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_19kfk17</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0ycnbyf</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g502yj</bpmn2:outgoing> </bpmn2:serviceTask> + <bpmn2:callActivity id="CallActivity_sdncHandlerReq" name="SDNC ChangeModel (svc instance)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1q3rjt4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ycnbyf</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1q3rjt4" sourceRef="SDNCChangeModelServiceInstance" targetRef="CallActivity_sdncHandlerReq" /> + <bpmn2:sequenceFlow id="SequenceFlow_0ycnbyf" sourceRef="CallActivity_sdncHandlerReq" targetRef="AAIUpdateModelServiceInstance" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -38,31 +47,41 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18i4a05_di" bpmnElement="SequenceFlow_18i4a05"> <di:waypoint xsi:type="dc:Point" x="111" y="106" /> - <di:waypoint xsi:type="dc:Point" x="234" y="106" /> + <di:waypoint xsi:type="dc:Point" x="158" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="127.5" y="85" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_19kfk17_di" bpmnElement="SequenceFlow_19kfk17"> - <di:waypoint xsi:type="dc:Point" x="334" y="106" /> - <di:waypoint xsi:type="dc:Point" x="390" y="106" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="317" y="85" width="90" height="12" /> + <dc:Bounds x="89.5" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0g502yj_di" bpmnElement="SequenceFlow_0g502yj"> - <di:waypoint xsi:type="dc:Point" x="490" y="106" /> + <di:waypoint xsi:type="dc:Point" x="589" y="106" /> <di:waypoint xsi:type="dc:Point" x="632" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="516" y="85" width="90" height="12" /> + <dc:Bounds x="565.5" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_03km5f0_di" bpmnElement="SDNCChangeModelServiceInstance"> - <dc:Bounds x="234" y="66" width="100" height="80" /> + <dc:Bounds x="158" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_10b2mxq_di" bpmnElement="AAIUpdateModelServiceInstance"> - <dc:Bounds x="390" y="66" width="100" height="80" /> + <dc:Bounds x="489" y="66" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1heowq0_di" bpmnElement="CallActivity_sdncHandlerReq"> + <dc:Bounds x="315" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1q3rjt4_di" bpmnElement="SequenceFlow_1q3rjt4"> + <di:waypoint xsi:type="dc:Point" x="258" y="106" /> + <di:waypoint xsi:type="dc:Point" x="315" y="106" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="286.5" y="85" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ycnbyf_di" bpmnElement="SequenceFlow_0ycnbyf"> + <di:waypoint xsi:type="dc:Point" x="415" y="106" /> + <di:waypoint xsi:type="dc:Point" x="489" y="106" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="452" y="85" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn index fd247d26eb..28957c6197 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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: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.8.2"> <bpmn:process id="ChangeModelVfModuleBB" name="ChangeModelVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ChangeModelVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> @@ -10,14 +10,23 @@ </bpmn:endEvent> <bpmn:serviceTask id="ChangeModelVfModule" name=" SDNC Change (vf model) " camunda:expression="${SDNCChangeAssignTasks.changeAssignModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14kvrbe</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0m403q5</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_14kvrbe" sourceRef="ChangeModelVfModule" targetRef="UpdateVfModuleModel" /> <bpmn:serviceTask id="UpdateVfModuleModel" name=" AAI Update (vf model) " camunda:expression="${AAIUpdateTasks.updateModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_14kvrbe</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0rpp4hi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xsp0pv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0xsp0pv" sourceRef="UpdateVfModuleModel" targetRef="ChangeModelVfModuleBB_End" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC ChangeModel (vf module)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0m403q5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rpp4hi</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0m403q5" sourceRef="ChangeModelVfModule" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_0rpp4hi" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleModel" /> </bpmn:process> <bpmn:error id="Error_0q258vt" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -30,35 +39,45 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="297" y="120" /> + <di:waypoint xsi:type="dc:Point" x="259" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="208" y="99" width="90" height="12" /> + <dc:Bounds x="189" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ChangeModelVfModuleBB_End"> - <dc:Bounds x="636" y="102" width="36" height="36" /> + <dc:Bounds x="693" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="645" y="142" width="19" height="12" /> + <dc:Bounds x="667" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ChangeModelVfModule"> - <dc:Bounds x="297" y="80" width="100" height="80" /> + <dc:Bounds x="259" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_14kvrbe_di" bpmnElement="SequenceFlow_14kvrbe"> - <di:waypoint xsi:type="dc:Point" x="397" y="120" /> - <di:waypoint xsi:type="dc:Point" x="435" y="120" /> + <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleModel"> + <dc:Bounds x="552" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> + <di:waypoint xsi:type="dc:Point" x="652" y="120" /> + <di:waypoint xsi:type="dc:Point" x="693" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="371" y="99" width="90" height="12" /> + <dc:Bounds x="627.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleModel"> - <dc:Bounds x="435" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="CallActivity_1y6gpyq_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="403" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="535" y="120" /> - <di:waypoint xsi:type="dc:Point" x="636" y="120" /> + <bpmndi:BPMNEdge id="SequenceFlow_0m403q5_di" bpmnElement="SequenceFlow_0m403q5"> + <di:waypoint xsi:type="dc:Point" x="359" y="120" /> + <di:waypoint xsi:type="dc:Point" x="403" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="381" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rpp4hi_di" bpmnElement="SequenceFlow_0rpp4hi"> + <di:waypoint xsi:type="dc:Point" x="503" y="120" /> + <di:waypoint xsi:type="dc:Point" x="552" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="540.5" y="99" width="90" height="12" /> + <dc:Bounds x="527.5" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn index b320c12a5e..59c35c3c5b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.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.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ChangeModelVnfBB" name="ChangeModelVnfBB" isExecutable="true"> <bpmn2:startEvent id="ChangeModelVnf_Start"> <bpmn2:outgoing>SequenceFlow_18i4a05</bpmn2:outgoing> @@ -8,14 +8,13 @@ <bpmn2:incoming>SequenceFlow_0g502yj</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_18i4a05" sourceRef="ChangeModelVnf_Start" targetRef="SDNCChangeModel" /> - <bpmn2:sequenceFlow id="SequenceFlow_19kfk17" sourceRef="SDNCChangeModel" targetRef="AAIUpdateModel" /> <bpmn2:sequenceFlow id="SequenceFlow_0g502yj" sourceRef="AAIUpdateModel" targetRef="ChangeModelVnf_End" /> <bpmn2:serviceTask id="SDNCChangeModel" name=" SDNC Change (vnf model) " camunda:expression="${SDNCChangeAssignTasks.changeModelVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_18i4a05</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_19kfk17</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_17yjhsl</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="AAIUpdateModel" name=" AAI Update (vnf model) " camunda:expression="${AAIUpdateTasks.updateObjectVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_19kfk17</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1h1zrcl</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g502yj</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:subProcess id="SubProcess_1nibii6" name="Error Handling " triggeredByEvent="true"> @@ -29,6 +28,16 @@ </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0s2743f" sourceRef="StartEvent_1fnfrm5" targetRef="EndEvent_124ugc0" /> </bpmn2:subProcess> + <bpmn2:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Change Model (vnf)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_17yjhsl</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1h1zrcl</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_17yjhsl" sourceRef="SDNCChangeModel" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn2:sequenceFlow id="SequenceFlow_1h1zrcl" sourceRef="CallActivity_sdncHandlerCall" targetRef="AAIUpdateModel" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -49,30 +58,23 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18i4a05_di" bpmnElement="SequenceFlow_18i4a05"> <di:waypoint xsi:type="dc:Point" x="111" y="106" /> - <di:waypoint xsi:type="dc:Point" x="213" y="106" /> + <di:waypoint xsi:type="dc:Point" x="158" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="162" y="85" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_19kfk17_di" bpmnElement="SequenceFlow_19kfk17"> - <di:waypoint xsi:type="dc:Point" x="313" y="106" /> - <di:waypoint xsi:type="dc:Point" x="423" y="106" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="368" y="85" width="0" height="12" /> + <dc:Bounds x="89.5" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0g502yj_di" bpmnElement="SequenceFlow_0g502yj"> - <di:waypoint xsi:type="dc:Point" x="523" y="106" /> + <di:waypoint xsi:type="dc:Point" x="590" y="106" /> <di:waypoint xsi:type="dc:Point" x="632" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="577.5" y="85" width="0" height="12" /> + <dc:Bounds x="566" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_03km5f0_di" bpmnElement="SDNCChangeModel"> - <dc:Bounds x="213" y="66" width="100" height="80" /> + <dc:Bounds x="158" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_10b2mxq_di" bpmnElement="AAIUpdateModel"> - <dc:Bounds x="423" y="66" width="100" height="80" /> + <dc:Bounds x="490" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1nibii6_di" bpmnElement="SubProcess_1nibii6" isExpanded="true"> <dc:Bounds x="164" y="244" width="231" height="135" /> @@ -96,6 +98,23 @@ <dc:Bounds x="287.5" y="297" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_17x4av7_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="322" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17yjhsl_di" bpmnElement="SequenceFlow_17yjhsl"> + <di:waypoint xsi:type="dc:Point" x="258" y="106" /> + <di:waypoint xsi:type="dc:Point" x="322" y="106" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="290" y="85" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1h1zrcl_di" bpmnElement="SequenceFlow_1h1zrcl"> + <di:waypoint xsi:type="dc:Point" x="422" y="106" /> + <di:waypoint xsi:type="dc:Point" x="490" y="106" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="456" y="85" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn index 5c85d17403..29a03c4e6b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.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.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeactivateNetworkBB" name="DeactivateNetworkBB" isExecutable="true"> <bpmn2:startEvent id="DeactivateNetworkBB_Start" name="Start"> <bpmn2:outgoing>SequenceFlow_05elmhj</bpmn2:outgoing> @@ -9,15 +9,24 @@ </bpmn2:endEvent> <bpmn2:serviceTask id="DeactivateNetworkSDNC" name=" SDNC Deactivate Network " camunda:expression="${SDNCDeactivateTasks.deactivateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05elmhj</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0xbvwsu</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0hfjdl4</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="DeactivateNetworkAAI" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0xbvwsu</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0cu0wy4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18atf08</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_05elmhj" sourceRef="DeactivateNetworkBB_Start" targetRef="DeactivateNetworkSDNC" /> - <bpmn2:sequenceFlow id="SequenceFlow_0xbvwsu" sourceRef="DeactivateNetworkSDNC" targetRef="DeactivateNetworkAAI" /> <bpmn2:sequenceFlow id="SequenceFlow_18atf08" sourceRef="DeactivateNetworkAAI" targetRef="DeactivateNetworkBB_End" /> + <bpmn2:callActivity id="CallActivity_sdncHandler" name="SDNC Deactivate (network)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0hfjdl4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0cu0wy4</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0hfjdl4" sourceRef="DeactivateNetworkSDNC" targetRef="CallActivity_sdncHandler" /> + <bpmn2:sequenceFlow id="SequenceFlow_0cu0wy4" sourceRef="CallActivity_sdncHandler" targetRef="DeactivateNetworkAAI" /> </bpmn2:process> <bpmn2:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -31,40 +40,46 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="DeactivateNetworkBB_End"> - <dc:Bounds x="672" y="100" width="36" height="36" /> + <dc:Bounds x="773" y="100" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="682" y="136" width="19" height="12" /> + <dc:Bounds x="783" y="136" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1k7d8ih_di" bpmnElement="DeactivateNetworkSDNC"> - <dc:Bounds x="350" y="78" width="100" height="80" /> + <dc:Bounds x="326" y="78" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1911vum_di" bpmnElement="DeactivateNetworkAAI"> - <dc:Bounds x="499" y="78" width="100" height="80" /> + <dc:Bounds x="620" y="78" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05elmhj_di" bpmnElement="SequenceFlow_05elmhj"> <di:waypoint xsi:type="dc:Point" x="278" y="118" /> - <di:waypoint xsi:type="dc:Point" x="350" y="118" /> + <di:waypoint xsi:type="dc:Point" x="326" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="269" y="93" width="90" height="0" /> + <dc:Bounds x="257" y="103" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xbvwsu_di" bpmnElement="SequenceFlow_0xbvwsu"> - <di:waypoint xsi:type="dc:Point" x="450" y="118" /> - <di:waypoint xsi:type="dc:Point" x="475" y="118" /> - <di:waypoint xsi:type="dc:Point" x="475" y="118" /> - <di:waypoint xsi:type="dc:Point" x="499" y="118" /> + <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> + <di:waypoint xsi:type="dc:Point" x="720" y="118" /> + <di:waypoint xsi:type="dc:Point" x="773" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="445" y="118" width="90" height="0" /> + <dc:Bounds x="701.5" y="103" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> - <di:waypoint xsi:type="dc:Point" x="599" y="118" /> - <di:waypoint xsi:type="dc:Point" x="636" y="118" /> - <di:waypoint xsi:type="dc:Point" x="636" y="118" /> - <di:waypoint xsi:type="dc:Point" x="672" y="118" /> + <bpmndi:BPMNShape id="CallActivity_0q2nryd_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="465" y="78" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hfjdl4_di" bpmnElement="SequenceFlow_0hfjdl4"> + <di:waypoint xsi:type="dc:Point" x="426" y="118" /> + <di:waypoint xsi:type="dc:Point" x="465" y="118" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="445.5" y="97" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0cu0wy4_di" bpmnElement="SequenceFlow_0cu0wy4"> + <di:waypoint xsi:type="dc:Point" x="565" y="118" /> + <di:waypoint xsi:type="dc:Point" x="620" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="606" y="118" width="90" height="0" /> + <dc:Bounds x="592.5" y="97" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn index 5284788b89..41517871d0 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> <bpmn:process id="DeactivateServiceInstanceBB" name="DeactivateServiceInstanceBB" isExecutable="true"> <bpmn:startEvent id="Start_DeactivateServiceInstanceBB" name="Start"> <bpmn:outgoing>SequenceFlow_101w1ck</bpmn:outgoing> @@ -7,17 +7,26 @@ <bpmn:endEvent id="End_DeactivateServiceInstanceBB" name="end"> <bpmn:incoming>SequenceFlow_0pioehv</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_00q7fsg" sourceRef="Task_DeactivateServiceInstance_SDNC" targetRef="Task_DeactivateServiceInstance_AAI" /> <bpmn:sequenceFlow id="SequenceFlow_0pioehv" sourceRef="Task_DeactivateServiceInstance_AAI" targetRef="End_DeactivateServiceInstanceBB" /> <bpmn:serviceTask id="Task_DeactivateServiceInstance_AAI" name=" AAI Update (svc instance) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_00q7fsg</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ck1p4o</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pioehv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_DeactivateServiceInstance_SDNC" name=" SDNC Deactivate (svc instance) " camunda:expression="${SDNCDeactivateTasks.deactivateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_101w1ck</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00q7fsg</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1j9qa4p</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_101w1ck" sourceRef="Start_DeactivateServiceInstanceBB" targetRef="Task_DeactivateServiceInstance_SDNC" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Deactivate (svc instance)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1j9qa4p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ck1p4o</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1ck1p4o" sourceRef="CallActivity_sdncHandler" targetRef="Task_DeactivateServiceInstance_AAI" /> + <bpmn:sequenceFlow id="SequenceFlow_1j9qa4p" sourceRef="Task_DeactivateServiceInstance_SDNC" targetRef="CallActivity_sdncHandler" /> </bpmn:process> <bpmn:error id="Error_05rnr6a" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -29,27 +38,20 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1qdtskz_di" bpmnElement="End_DeactivateServiceInstanceBB"> - <dc:Bounds x="416" y="102" width="36" height="36" /> + <dc:Bounds x="541" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="425" y="142" width="18" height="12" /> + <dc:Bounds x="550" y="142" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_00q7fsg_di" bpmnElement="SequenceFlow_00q7fsg"> - <di:waypoint xsi:type="dc:Point" x="216" y="120" /> - <di:waypoint xsi:type="dc:Point" x="262" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="239" y="105" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0pioehv_di" bpmnElement="SequenceFlow_0pioehv"> - <di:waypoint xsi:type="dc:Point" x="362" y="120" /> - <di:waypoint xsi:type="dc:Point" x="416" y="120" /> + <di:waypoint xsi:type="dc:Point" x="520" y="120" /> + <di:waypoint xsi:type="dc:Point" x="541" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="389" y="99" width="0" height="0" /> + <dc:Bounds x="485.5" y="105" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1d9vh4e_di" bpmnElement="Task_DeactivateServiceInstance_AAI"> - <dc:Bounds x="262" y="80" width="100" height="80" /> + <dc:Bounds x="420" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_04l854m_di" bpmnElement="Task_DeactivateServiceInstance_SDNC"> <dc:Bounds x="116" y="80" width="100" height="80" /> @@ -61,6 +63,23 @@ <dc:Bounds x="87.5" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0fm7piq_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="265" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ck1p4o_di" bpmnElement="SequenceFlow_1ck1p4o"> + <di:waypoint xsi:type="dc:Point" x="365" y="120" /> + <di:waypoint xsi:type="dc:Point" x="420" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="392.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1j9qa4p_di" bpmnElement="SequenceFlow_1j9qa4p"> + <di:waypoint xsi:type="dc:Point" x="216" y="120" /> + <di:waypoint xsi:type="dc:Point" x="265" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="240.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn index f30a1f18ce..37fd2dbd98 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn @@ -1,23 +1,32 @@ <?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: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.8.2"> <bpmn:process id="DeactivateVfModuleBB" name="DeactivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeactivateVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_0m379r2</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="DeactivateVfModule" name=" SDNC Deactivate (vf module) " camunda:expression="${SDNCDeactivateTasks.deactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0m379r2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_01bdpek</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_15ep3y7</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0m379r2" sourceRef="DeactivateVfModuleBB_Start" targetRef="DeactivateVfModule" /> <bpmn:serviceTask id="UpdateVfModuleDeactivateStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_01bdpek</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1gx4xce</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1y1c7fh</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_01bdpek" sourceRef="DeactivateVfModule" targetRef="UpdateVfModuleDeactivateStatus" /> <bpmn:endEvent id="DeactivateVfModuleBB_End" name="End"> <bpmn:incoming>SequenceFlow_1y1c7fh</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1y1c7fh" sourceRef="UpdateVfModuleDeactivateStatus" targetRef="DeactivateVfModuleBB_End" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Deactivate (vf module)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15ep3y7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gx4xce</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_15ep3y7" sourceRef="DeactivateVfModule" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_1gx4xce" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleDeactivateStatus" /> </bpmn:process> <bpmn:error id="Error_0qg4xhp" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -29,40 +38,46 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rz90rp_di" bpmnElement="DeactivateVfModule"> - <dc:Bounds x="275" y="80" width="100" height="80" /> + <dc:Bounds x="261" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0m379r2_di" bpmnElement="SequenceFlow_0m379r2"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="275" y="120" /> + <di:waypoint xsi:type="dc:Point" x="261" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="242" y="99" width="0" height="12" /> + <dc:Bounds x="190" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0lyevan_di" bpmnElement="UpdateVfModuleDeactivateStatus"> - <dc:Bounds x="432" y="80" width="100" height="80" /> + <dc:Bounds x="550" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_01bdpek_di" bpmnElement="SequenceFlow_01bdpek"> - <di:waypoint xsi:type="dc:Point" x="375" y="120" /> - <di:waypoint xsi:type="dc:Point" x="401" y="120" /> - <di:waypoint xsi:type="dc:Point" x="401" y="120" /> - <di:waypoint xsi:type="dc:Point" x="432" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="416" y="114" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1h4ik86_di" bpmnElement="DeactivateVfModuleBB_End"> - <dc:Bounds x="589" y="102" width="36" height="36" /> + <dc:Bounds x="686" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="598" y="142" width="19" height="12" /> + <dc:Bounds x="695" y="142" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1y1c7fh_di" bpmnElement="SequenceFlow_1y1c7fh"> - <di:waypoint xsi:type="dc:Point" x="532" y="120" /> - <di:waypoint xsi:type="dc:Point" x="557" y="120" /> - <di:waypoint xsi:type="dc:Point" x="557" y="120" /> - <di:waypoint xsi:type="dc:Point" x="589" y="120" /> + <di:waypoint xsi:type="dc:Point" x="650" y="120" /> + <di:waypoint xsi:type="dc:Point" x="686" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="623" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0pp1hlz_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="401" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15ep3y7_di" bpmnElement="SequenceFlow_15ep3y7"> + <di:waypoint xsi:type="dc:Point" x="361" y="120" /> + <di:waypoint xsi:type="dc:Point" x="401" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="381" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gx4xce_di" bpmnElement="SequenceFlow_1gx4xce"> + <di:waypoint xsi:type="dc:Point" x="501" y="120" /> + <di:waypoint xsi:type="dc:Point" x="550" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="572" y="114" width="0" height="12" /> + <dc:Bounds x="525.5" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn index 790cab1737..c627789119 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn @@ -1,23 +1,32 @@ <?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: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.8.2"> <bpmn:process id="DeactivateVnfBB" name="DeactivateVnfBB" isExecutable="true"> <bpmn:startEvent id="Start_DeactivateVnfBB" name="start"> <bpmn:outgoing>SequenceFlow_0k9qnoi</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0k9qnoi" sourceRef="Start_DeactivateVnfBB" targetRef="Task_SDNCAdapterVnfTopologyDeactivate" /> - <bpmn:sequenceFlow id="SequenceFlow_0r6pzwt" sourceRef="Task_SDNCAdapterVnfTopologyDeactivate" targetRef="Task_DeactivateOrchestrationStatusVnf" /> <bpmn:endEvent id="End_DeactivateVnfBB" name="end"> <bpmn:incoming>SequenceFlow_0vnitwg</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0vnitwg" sourceRef="Task_DeactivateOrchestrationStatusVnf" targetRef="End_DeactivateVnfBB" /> <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyDeactivate" name=" SDNC Deactivate (vnf) " camunda:expression="${SDNCDeactivateTasks.deactivateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0k9qnoi</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0r6pzwt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_000o6c2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_DeactivateOrchestrationStatusVnf" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0r6pzwt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ageldf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0vnitwg</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Deactivate (vnf)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_000o6c2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ageldf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_000o6c2" sourceRef="Task_SDNCAdapterVnfTopologyDeactivate" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_1ageldf" sourceRef="CallActivity_sdncHandler" targetRef="Task_DeactivateOrchestrationStatusVnf" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeactivateVnfBB"> @@ -34,32 +43,42 @@ <dc:Bounds x="236" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0r6pzwt_di" bpmnElement="SequenceFlow_0r6pzwt"> - <di:waypoint xsi:type="dc:Point" x="363" y="120" /> - <di:waypoint xsi:type="dc:Point" x="422" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="392.5" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1ad7eym_di" bpmnElement="End_DeactivateVnfBB"> - <dc:Bounds x="572" y="102" width="36" height="36" /> + <dc:Bounds x="753" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="580" y="142" width="20" height="12" /> + <dc:Bounds x="762" y="142" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vnitwg_di" bpmnElement="SequenceFlow_0vnitwg"> - <di:waypoint xsi:type="dc:Point" x="522" y="120" /> - <di:waypoint xsi:type="dc:Point" x="572" y="120" /> + <di:waypoint xsi:type="dc:Point" x="708" y="120" /> + <di:waypoint xsi:type="dc:Point" x="753" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="547" y="99" width="0" height="12" /> + <dc:Bounds x="685.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1k98q3r_di" bpmnElement="Task_SDNCAdapterVnfTopologyDeactivate"> <dc:Bounds x="263" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1vg25fs_di" bpmnElement="Task_DeactivateOrchestrationStatusVnf"> - <dc:Bounds x="422" y="80" width="100" height="80" /> + <dc:Bounds x="608" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1t6shsw_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="431" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_000o6c2_di" bpmnElement="SequenceFlow_000o6c2"> + <di:waypoint xsi:type="dc:Point" x="363" y="120" /> + <di:waypoint xsi:type="dc:Point" x="431" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="397" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ageldf_di" bpmnElement="SequenceFlow_1ageldf"> + <di:waypoint xsi:type="dc:Point" x="531" y="120" /> + <di:waypoint xsi:type="dc:Point" x="608" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="569.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index bb7abf7d7d..5cf41b655b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -10,14 +10,13 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" /> <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mxrfqv</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_08tvhtf" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" /> <bpmn:endEvent id="DeleteVfModuleBB_End"> - <bpmn:incoming>SequenceFlow_1mxrfqv</bpmn:incoming> + <bpmn:incoming>SequenceFlow_09l7pcg</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1mxrfqv" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> @@ -29,7 +28,7 @@ <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleDeleteStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" /> <bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling " triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_1xp6ewt"> <bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing> @@ -41,6 +40,12 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0h607z0" sourceRef="StartEvent_1xp6ewt" targetRef="EndEvent_0guhjau" /> </bpmn:subProcess> + <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01vfwtp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> @@ -61,7 +66,7 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="593" y="80" width="100" height="80" /> + <dc:Bounds x="762" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> <di:waypoint xsi:type="dc:Point" x="361" y="120" /> @@ -71,26 +76,19 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="746" y="102" width="36" height="36" /> + <dc:Bounds x="922" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="754" y="142" width="19" height="12" /> + <dc:Bounds x="940" y="142" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mxrfqv_di" bpmnElement="SequenceFlow_1mxrfqv"> - <di:waypoint xsi:type="dc:Point" x="693" y="120" /> - <di:waypoint xsi:type="dc:Point" x="746" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="674.5" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> <dc:Bounds x="427" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> <di:waypoint xsi:type="dc:Point" x="527" y="120" /> - <di:waypoint xsi:type="dc:Point" x="593" y="120" /> + <di:waypoint xsi:type="dc:Point" x="604" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="99" width="0" height="12" /> + <dc:Bounds x="566" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> @@ -115,6 +113,23 @@ <dc:Bounds x="386.5" y="335" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="604" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> + <di:waypoint xsi:type="dc:Point" x="704" y="120" /> + <di:waypoint xsi:type="dc:Point" x="762" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="733" y="95" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> + <di:waypoint xsi:type="dc:Point" x="862" y="120" /> + <di:waypoint xsi:type="dc:Point" x="922" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="892" y="95" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn index f2bd2246e4..746d1f2c5f 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="DeleteVolumeGroupBB" name="DeleteVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="DeleteVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -9,7 +9,7 @@ <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="UpdateVolumeGroupAAI" name=" AAI Update (volume grp) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hml0t6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mh0v9h" sourceRef="UpdateVolumeGroupAAI" targetRef="DeleteVolumeGroupBB_End" /> @@ -18,7 +18,7 @@ <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_13ngwev</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0fkan8t" sourceRef="VnfAdapter" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkan8t" sourceRef="VnfAdapter" targetRef="UpdateVolumeGroupHeatStackId" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> @@ -43,6 +43,11 @@ </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_07rsz9o" sourceRef="StartEvent_1gun94q" targetRef="EndEvent_18lpeyi" /> </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_0hml0t6" sourceRef="UpdateVolumeGroupHeatStackId" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:serviceTask id="UpdateVolumeGroupHeatStackId" name=" AAI Update (volume grp) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hml0t6</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" /> @@ -62,19 +67,19 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="DeleteVolumeGroupBB_End"> - <dc:Bounds x="824" y="102" width="36" height="36" /> + <dc:Bounds x="978" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="842" y="142" width="0" height="0" /> + <dc:Bounds x="996" y="142" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="UpdateVolumeGroupAAI"> - <dc:Bounds x="665" y="80" width="100" height="80" /> + <dc:Bounds x="822" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h"> - <di:waypoint xsi:type="dc:Point" x="765" y="120" /> - <di:waypoint xsi:type="dc:Point" x="824" y="120" /> + <di:waypoint xsi:type="dc:Point" x="922" y="120" /> + <di:waypoint xsi:type="dc:Point" x="978" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="99" width="0" height="0" /> + <dc:Bounds x="950" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_13ngwev_di" bpmnElement="SequenceFlow_13ngwev"> @@ -89,9 +94,9 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fkan8t_di" bpmnElement="SequenceFlow_0fkan8t"> <di:waypoint xsi:type="dc:Point" x="626" y="120" /> - <di:waypoint xsi:type="dc:Point" x="665" y="120" /> + <di:waypoint xsi:type="dc:Point" x="678" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="646" y="105" width="0" height="0" /> + <dc:Bounds x="652" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0li7q97_di" bpmnElement="VnfAdapter"> @@ -121,6 +126,16 @@ <dc:Bounds x="543" y="305" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hml0t6_di" bpmnElement="SequenceFlow_0hml0t6"> + <di:waypoint xsi:type="dc:Point" x="778" y="120" /> + <di:waypoint xsi:type="dc:Point" x="822" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="800" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1eatpiw_di" bpmnElement="UpdateVolumeGroupHeatStackId"> + <dc:Bounds x="678" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn index d123153932..0be7c55596 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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: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.8.2"> <bpmn:process id="SDNCHandler" name="SDNC" isExecutable="true"> <bpmn:startEvent id="SDNC_Start"> <bpmn:outgoing>SequenceFlow_1n0j3hz</bpmn:outgoing> @@ -12,11 +12,6 @@ <bpmn:incoming>SequenceFlow_0flbj8a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07vnhri</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="BoundaryEvent_1lv4854" attachedToRef="Call_SDNC"> - <bpmn:outgoing>SequenceFlow_0valp88</bpmn:outgoing> - <bpmn:errorEventDefinition camunda:errorCodeVariable="SDNCSyncError" /> - </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="SequenceFlow_0valp88" sourceRef="BoundaryEvent_1lv4854" targetRef="Task_1o29lpk" /> <bpmn:subProcess id="SubProcess_0y8yozw" name="Wait for Callback" camunda:asyncAfter="true" camunda:exclusive="false"> <bpmn:incoming>SequenceFlow_0rh24pq</bpmn:incoming> <bpmn:incoming>SequenceFlow_0yve6l6</bpmn:incoming> @@ -76,9 +71,6 @@ <bpmn:serviceTask id="Task_1un0flc" name="Handle Timeout" camunda:expression="${SDNCRequestTasks.handleTimeOutException(execution)}"> <bpmn:incoming>SequenceFlow_1yifu46</bpmn:incoming> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_1o29lpk" name="Handle Error" camunda:expression="${SDNCRequestTasks.handleSyncError(execution)}"> - <bpmn:incoming>SequenceFlow_0valp88</bpmn:incoming> - </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_06oc4iz" name="SDNCCallbackMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -98,21 +90,6 @@ <bpmndi:BPMNShape id="ServiceTask_1i5x1m6_di" bpmnElement="Call_SDNC"> <dc:Bounds x="15" y="112" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BoundaryEvent_1wxlsn8_di" bpmnElement="BoundaryEvent_1lv4854"> - <dc:Bounds x="97" y="174" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="452" y="520" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0valp88_di" bpmnElement="SequenceFlow_0valp88"> - <di:waypoint xsi:type="dc:Point" x="115" y="210" /> - <di:waypoint xsi:type="dc:Point" x="115" y="278" /> - <di:waypoint xsi:type="dc:Point" x="115" y="278" /> - <di:waypoint xsi:type="dc:Point" x="115" y="312" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="85" y="271.5" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0y8yozw_di" bpmnElement="SubProcess_0y8yozw" isExpanded="true"> <dc:Bounds x="278" y="-144" width="340" height="153" /> </bpmndi:BPMNShape> @@ -251,9 +228,6 @@ <bpmndi:BPMNShape id="ServiceTask_08b89dm_di" bpmnElement="Task_1un0flc"> <dc:Bounds x="748" y="-185" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cyot3r_di" bpmnElement="Task_1o29lpk"> - <dc:Bounds x="65" y="312" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn index fdae49fdda..8e4c8501b5 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn @@ -1,21 +1,20 @@ <?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: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.8.2"> <bpmn:process id="UnassignNetworkBB" name="UnassignNetworkBB" isExecutable="true"> <bpmn:startEvent id="Start_UnassignNetworkBB" name="start"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="Task_SNDCUnAssign" name=" SDNC Unassign (network) " camunda:expression="${SDNCUnassignTasks.unassignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0le4vrj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1woj6rc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="End_UnassignNetworkBB" name="end"> <bpmn:incoming>SequenceFlow_0csh9dc</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" /> - <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="Task_DeleteNetwork" /> <bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_DeleteNetwork" targetRef="End_UnassignNetworkBB" /> <bpmn:serviceTask id="Task_DeleteNetwork" name=" AAI Delete (network) " camunda:expression="${AAIDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_15oc7ot</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0csh9dc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_VfModuleRelatioship" name="Veriyf 'vf-module' relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), "vf-module")}"> @@ -28,6 +27,16 @@ <bpmn:incoming>SequenceFlow_0mxe1a7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0le4vrj</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Unassign (network)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1woj6rc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15oc7ot</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1woj6rc" sourceRef="Task_SNDCUnAssign" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn:sequenceFlow id="SequenceFlow_15oc7ot" sourceRef="CallActivity_sdncHandlerCall" targetRef="Task_DeleteNetwork" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignNetworkBB"> @@ -41,9 +50,9 @@ <dc:Bounds x="665" y="97" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_UnassignNetworkBB"> - <dc:Bounds x="946" y="119" width="36" height="36" /> + <dc:Bounds x="1084" y="119" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="955" y="159" width="18" height="12" /> + <dc:Bounds x="1093" y="159" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> @@ -53,22 +62,15 @@ <dc:Bounds x="295" y="122" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt"> - <di:waypoint xsi:type="dc:Point" x="765" y="137" /> - <di:waypoint xsi:type="dc:Point" x="804" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="785" y="122" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0csh9dc_di" bpmnElement="SequenceFlow_0csh9dc"> - <di:waypoint xsi:type="dc:Point" x="904" y="137" /> - <di:waypoint xsi:type="dc:Point" x="946" y="137" /> + <di:waypoint xsi:type="dc:Point" x="1054" y="137" /> + <di:waypoint xsi:type="dc:Point" x="1084" y="137" /> <bpmndi:BPMNLabel> - <dc:Bounds x="925" y="122" width="0" height="0" /> + <dc:Bounds x="1024" y="122" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0s6d1be_di" bpmnElement="Task_DeleteNetwork"> - <dc:Bounds x="804" y="97" width="100" height="80" /> + <dc:Bounds x="954" y="97" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_194x6el_di" bpmnElement="Task_VfModuleRelatioship"> <dc:Bounds x="375" y="97" width="100" height="80" /> @@ -90,6 +92,25 @@ <bpmndi:BPMNShape id="ServiceTask_1ev9w69_di" bpmnElement="Task_GetCloudRegionVersion"> <dc:Bounds x="524" y="97" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_172bbje_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="813" y="97" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1woj6rc_di" bpmnElement="SequenceFlow_1woj6rc"> + <di:waypoint xsi:type="dc:Point" x="765" y="137" /> + <di:waypoint xsi:type="dc:Point" x="787" y="137" /> + <di:waypoint xsi:type="dc:Point" x="787" y="137" /> + <di:waypoint xsi:type="dc:Point" x="813" y="137" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="802" y="131" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15oc7ot_di" bpmnElement="SequenceFlow_15oc7ot"> + <di:waypoint xsi:type="dc:Point" x="913" y="137" /> + <di:waypoint xsi:type="dc:Point" x="954" y="137" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="933.5" y="116" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn index f077c78348..08f17469da 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn @@ -1,23 +1,32 @@ <?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: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.8.2"> <bpmn:process id="UnassignServiceInstanceBB" name="UnassignServiceInstanceBB" isExecutable="true"> <bpmn:startEvent id="Start_UnassignServiceInstanceBB"> <bpmn:outgoing>SequenceFlow_0fzrhkc</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="Task_AAIDeleteServiceInstance" name=" AAI Delete (svc instance) " camunda:expression="${AAIDeleteTasks.deleteServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0pu9j6i</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0uzdp0c</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0sfeg65</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0sfeg65" sourceRef="Task_AAIDeleteServiceInstance" targetRef="End_UnassignServiceInstanceBB" /> <bpmn:serviceTask id="Task_SdncUnassignServiceInstance" name=" SDNC Unassign (svc instance) " camunda:expression="${SDNCUnassignTasks.unassignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0fzrhkc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pu9j6i</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_00dyi16</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0pu9j6i" sourceRef="Task_SdncUnassignServiceInstance" targetRef="Task_AAIDeleteServiceInstance" /> <bpmn:endEvent id="End_UnassignServiceInstanceBB"> <bpmn:incoming>SequenceFlow_0sfeg65</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0fzrhkc" sourceRef="Start_UnassignServiceInstanceBB" targetRef="Task_SdncUnassignServiceInstance" /> + <bpmn:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Unassign (svc instance)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_00dyi16</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uzdp0c</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_00dyi16" sourceRef="Task_SdncUnassignServiceInstance" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn:sequenceFlow id="SequenceFlow_0uzdp0c" sourceRef="CallActivity_sdncHandlerCall" targetRef="Task_AAIDeleteServiceInstance" /> </bpmn:process> <bpmn:error id="Error_041z84w" name="gDelegateError" errorCode="7000" /> <bpmn:error id="Error_027m7l6" name="Failed orchestration status verification" errorCode="7000" /> @@ -30,36 +39,46 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ltb3dj_di" bpmnElement="Task_AAIDeleteServiceInstance"> - <dc:Bounds x="708" y="191" width="100" height="80" /> + <dc:Bounds x="819" y="191" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sfeg65_di" bpmnElement="SequenceFlow_0sfeg65"> - <di:waypoint xsi:type="dc:Point" x="808" y="231" /> - <di:waypoint xsi:type="dc:Point" x="871" y="231" /> + <di:waypoint xsi:type="dc:Point" x="919" y="231" /> + <di:waypoint xsi:type="dc:Point" x="961" y="231" /> <bpmndi:BPMNLabel> - <dc:Bounds x="794.5" y="210" width="90" height="12" /> + <dc:Bounds x="895" y="210" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_11klnmn_di" bpmnElement="Task_SdncUnassignServiceInstance"> - <dc:Bounds x="563" y="191" width="100" height="80" /> + <dc:Bounds x="510" y="191" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0pu9j6i_di" bpmnElement="SequenceFlow_0pu9j6i"> - <di:waypoint xsi:type="dc:Point" x="663" y="231" /> - <di:waypoint xsi:type="dc:Point" x="708" y="231" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="640.5" y="210" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1p34ka9_di" bpmnElement="End_UnassignServiceInstanceBB"> - <dc:Bounds x="871" y="213" width="36" height="36" /> + <dc:Bounds x="961" y="213" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="883" y="255" width="18" height="12" /> + <dc:Bounds x="937" y="255" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fzrhkc_di" bpmnElement="SequenceFlow_0fzrhkc"> <di:waypoint xsi:type="dc:Point" x="480" y="231" /> - <di:waypoint xsi:type="dc:Point" x="563" y="231" /> + <di:waypoint xsi:type="dc:Point" x="510" y="231" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="450" y="210" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0q2i7pr_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="668" y="191" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00dyi16_di" bpmnElement="SequenceFlow_00dyi16"> + <di:waypoint xsi:type="dc:Point" x="610" y="231" /> + <di:waypoint xsi:type="dc:Point" x="668" y="231" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="639" y="210" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0uzdp0c_di" bpmnElement="SequenceFlow_0uzdp0c"> + <di:waypoint xsi:type="dc:Point" x="768" y="231" /> + <di:waypoint xsi:type="dc:Point" x="819" y="231" /> <bpmndi:BPMNLabel> - <dc:Bounds x="476.5" y="210" width="90" height="12" /> + <dc:Bounds x="793.5" y="210" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn index 0f3138121e..dd00078fb5 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn @@ -1,23 +1,32 @@ <?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: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.8.2"> <bpmn:process id="UnassignVfModuleBB" name="UnassignVfModuleBB" isExecutable="true"> <bpmn:startEvent id="UnassignVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1kfxl04</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="DeleteVfModule" name=" AAI Delete (vf module) " camunda:expression="${AAIDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1p2r4og</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0py9tf7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qa6sxx</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UnassignVfModule" name=" SDNC Unassign (vf module) " camunda:expression="${SDNCUnassignTasks.unassignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1kfxl04</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1p2r4og</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_152ntu2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="UnassignVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0qa6sxx</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1kfxl04" sourceRef="UnassignVfModuleBB_Start" targetRef="UnassignVfModule" /> - <bpmn:sequenceFlow id="SequenceFlow_1p2r4og" sourceRef="UnassignVfModule" targetRef="DeleteVfModule" /> <bpmn:sequenceFlow id="SequenceFlow_0qa6sxx" sourceRef="DeleteVfModule" targetRef="UnassignVfModuleBB_End" /> + <bpmn:callActivity id="CallActivity_sdncHandler" name="SDNC Unassign (vf module)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_152ntu2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0py9tf7</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_152ntu2" sourceRef="UnassignVfModule" targetRef="CallActivity_sdncHandler" /> + <bpmn:sequenceFlow id="SequenceFlow_0py9tf7" sourceRef="CallActivity_sdncHandler" targetRef="DeleteVfModule" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignVfModuleBB"> @@ -28,10 +37,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="DeleteVfModule"> - <dc:Bounds x="537" y="-25" width="100" height="80" /> + <dc:Bounds x="614" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="UnassignVfModule"> - <dc:Bounds x="387" y="-25" width="100" height="80" /> + <dc:Bounds x="298" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="UnassignVfModuleBB_End"> <dc:Bounds x="782" y="-3" width="36" height="36" /> @@ -41,23 +50,33 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kfxl04_di" bpmnElement="SequenceFlow_1kfxl04"> <di:waypoint xsi:type="dc:Point" x="249" y="15" /> - <di:waypoint xsi:type="dc:Point" x="387" y="15" /> + <di:waypoint xsi:type="dc:Point" x="298" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="273" y="0" width="90" height="0" /> + <dc:Bounds x="228.5" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1p2r4og_di" bpmnElement="SequenceFlow_1p2r4og"> - <di:waypoint xsi:type="dc:Point" x="487" y="15" /> - <di:waypoint xsi:type="dc:Point" x="537" y="15" /> + <bpmndi:BPMNEdge id="SequenceFlow_0qa6sxx_di" bpmnElement="SequenceFlow_0qa6sxx"> + <di:waypoint xsi:type="dc:Point" x="714" y="15" /> + <di:waypoint xsi:type="dc:Point" x="782" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="467" y="0" width="90" height="0" /> + <dc:Bounds x="703" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0qa6sxx_di" bpmnElement="SequenceFlow_0qa6sxx"> - <di:waypoint xsi:type="dc:Point" x="637" y="15" /> - <di:waypoint xsi:type="dc:Point" x="782" y="15" /> + <bpmndi:BPMNShape id="CallActivity_1x5hvzz_di" bpmnElement="CallActivity_sdncHandler"> + <dc:Bounds x="449" y="-25" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_152ntu2_di" bpmnElement="SequenceFlow_152ntu2"> + <di:waypoint xsi:type="dc:Point" x="398" y="15" /> + <di:waypoint xsi:type="dc:Point" x="449" y="15" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="423.5" y="-6" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0py9tf7_di" bpmnElement="SequenceFlow_0py9tf7"> + <di:waypoint xsi:type="dc:Point" x="549" y="15" /> + <di:waypoint xsi:type="dc:Point" x="614" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="664.5" y="0" width="90" height="0" /> + <dc:Bounds x="581.5" y="-6" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn index 4676acfa42..dec5681c9d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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: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.8.2"> <bpmn:process id="UnassignVnfBB" name="UnassignVnfBB" isExecutable="true"> <bpmn:startEvent id="UnassignVnfBB_Start"> <bpmn:outgoing>SequenceFlow_1kfxl04</bpmn:outgoing> @@ -10,7 +10,7 @@ </bpmn:serviceTask> <bpmn:serviceTask id="UnassignVnf" name=" SDNC Unassign (vnf) " camunda:expression="${SDNCUnassignTasks.unassignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1kfxl04</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_02st1i1</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ielrmh</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="UnassignVnfBB_End"> <bpmn:incoming>SequenceFlow_0qa6sxx</bpmn:incoming> @@ -18,11 +18,20 @@ <bpmn:sequenceFlow id="SequenceFlow_1kfxl04" sourceRef="UnassignVnfBB_Start" targetRef="UnassignVnf" /> <bpmn:sequenceFlow id="SequenceFlow_0qa6sxx" sourceRef="DeleteVnf" targetRef="UnassignVnfBB_End" /> <bpmn:serviceTask id="DeleteVnfInstanceGroups" name=" AAI Delete (instance grp) " camunda:expression="${UnassignVnf.deleteInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_02st1i1</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1cpzq86</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0w3s09a</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_02st1i1" sourceRef="UnassignVnf" targetRef="DeleteVnfInstanceGroups" /> <bpmn:sequenceFlow id="SequenceFlow_0w3s09a" sourceRef="DeleteVnfInstanceGroups" targetRef="DeleteVnf" /> + <bpmn:callActivity id="CallActivity_sdncHandlerCall" name="SDNC Unassign (vnf)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0ielrmh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1cpzq86</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0ielrmh" sourceRef="UnassignVnf" targetRef="CallActivity_sdncHandlerCall" /> + <bpmn:sequenceFlow id="SequenceFlow_1cpzq86" sourceRef="CallActivity_sdncHandlerCall" targetRef="DeleteVnfInstanceGroups" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignVnfBB"> @@ -33,10 +42,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="DeleteVnf"> - <dc:Bounds x="723" y="-25" width="100" height="80" /> + <dc:Bounds x="822" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="UnassignVnf"> - <dc:Bounds x="367" y="-25" width="100" height="80" /> + <dc:Bounds x="309" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="UnassignVnfBB_End"> <dc:Bounds x="959" y="-3" width="36" height="36" /> @@ -46,33 +55,43 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kfxl04_di" bpmnElement="SequenceFlow_1kfxl04"> <di:waypoint xsi:type="dc:Point" x="249" y="15" /> - <di:waypoint xsi:type="dc:Point" x="367" y="15" /> + <di:waypoint xsi:type="dc:Point" x="309" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="308" y="0" width="0" height="0" /> + <dc:Bounds x="234" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qa6sxx_di" bpmnElement="SequenceFlow_0qa6sxx"> - <di:waypoint xsi:type="dc:Point" x="823" y="15" /> + <di:waypoint xsi:type="dc:Point" x="922" y="15" /> <di:waypoint xsi:type="dc:Point" x="959" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="846" y="0" width="90" height="0" /> + <dc:Bounds x="895.5" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0b1276e_di" bpmnElement="DeleteVnfInstanceGroups"> - <dc:Bounds x="546" y="-25" width="100" height="80" /> + <dc:Bounds x="650" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_02st1i1_di" bpmnElement="SequenceFlow_02st1i1"> - <di:waypoint xsi:type="dc:Point" x="467" y="15" /> - <di:waypoint xsi:type="dc:Point" x="546" y="15" /> + <bpmndi:BPMNEdge id="SequenceFlow_0w3s09a_di" bpmnElement="SequenceFlow_0w3s09a"> + <di:waypoint xsi:type="dc:Point" x="750" y="15" /> + <di:waypoint xsi:type="dc:Point" x="822" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="506.5" y="-6" width="0" height="12" /> + <dc:Bounds x="741" y="-6" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0w3s09a_di" bpmnElement="SequenceFlow_0w3s09a"> - <di:waypoint xsi:type="dc:Point" x="646" y="15" /> - <di:waypoint xsi:type="dc:Point" x="723" y="15" /> + <bpmndi:BPMNShape id="CallActivity_195fzng_di" bpmnElement="CallActivity_sdncHandlerCall"> + <dc:Bounds x="471" y="-25" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ielrmh_di" bpmnElement="SequenceFlow_0ielrmh"> + <di:waypoint xsi:type="dc:Point" x="409" y="15" /> + <di:waypoint xsi:type="dc:Point" x="471" y="15" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="440" y="-6" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1cpzq86_di" bpmnElement="SequenceFlow_1cpzq86"> + <di:waypoint xsi:type="dc:Point" x="571" y="15" /> + <di:waypoint xsi:type="dc:Point" x="650" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="684.5" y="-6" width="0" height="12" /> + <dc:Bounds x="610.5" y="-6" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 07460a468d..bbb2a8a23d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -5,8 +5,8 @@ <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> </bpmn:startEvent> <bpmn:endEvent id="End_WorkflowActionBB" name="end"> - <bpmn:incoming>SequenceFlow_1rscv7d</bpmn:incoming> <bpmn:incoming>SequenceFlow_0x4urgp</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1pz6edz</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_15s0okp" sourceRef="Start_WorkflowActionBB" targetRef="Task_RetrieveBBExectuionList" /> <bpmn:callActivity id="Call_ExecuteBB" name="Execute BB" camunda:asyncBefore="true" calledElement="ExecuteBuildingBlock"> @@ -21,6 +21,7 @@ <camunda:in source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="RetryDuration" target="RetryDuration" /> + <camunda:in source="suppressRollback" target="suppressRollback" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing> @@ -43,7 +44,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_07h9d4y" sourceRef="Call_ExecuteBB" targetRef="ExclusiveGateway_Finished" /> <bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}"> <bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming> @@ -53,24 +54,11 @@ <bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_SetupCompleteMsoProcess" name="Setup Complete MSO Process" camunda:expression="${WorkflowActionBBTasks.setupCompleteMsoProcess(execution)}"> + <bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}"> <bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1pz6edz</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:callActivity id="Call_CompleteMsoProcess" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> - <bpmn:extensionElements> - <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> - <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="CMSO_ResponseCode" target="CMSO_ResponseCode" /> - <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> - <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1pz6edz</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1rscv7d</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1pz6edz" sourceRef="Task_SetupCompleteMsoProcess" targetRef="Call_CompleteMsoProcess" /> - <bpmn:sequenceFlow id="SequenceFlow_1rscv7d" sourceRef="Call_CompleteMsoProcess" targetRef="End_WorkflowActionBB" /> + <bpmn:sequenceFlow id="SequenceFlow_1pz6edz" sourceRef="Task_UpdateRequestComplete" targetRef="End_WorkflowActionBB" /> <bpmn:subProcess id="SubProcess_18226x4" name="Error Handling" triggeredByEvent="true"> <bpmn:startEvent id="ErrorStart" name="error"> <bpmn:outgoing>SequenceFlow_1edjl5x</bpmn:outgoing> @@ -79,7 +67,7 @@ <bpmn:endEvent id="ErrorEnd" name="end"> <bpmn:incoming>SequenceFlow_0wvzfgf</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="Task_UpdateDb" name="Update Request To Failed" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToFailed(execution)}"> + <bpmn:serviceTask id="Task_UpdateDb" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}"> <bpmn:incoming>SequenceFlow_024g0d1</bpmn:incoming> <bpmn:incoming>SequenceFlow_0eana0l</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0wvzfgf</bpmn:outgoing> @@ -116,7 +104,7 @@ <bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToFailed(execution)}"> + <bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}"> <bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1p8yxu6</bpmn:outgoing> </bpmn:serviceTask> @@ -164,13 +152,13 @@ <bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToFailedWithRollback(execution)}"> + <bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}"> <bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming> <bpmn:incoming>SequenceFlow_0l7kaba</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" /> <bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true"> @@ -193,7 +181,7 @@ <bpmn:outgoing>SequenceFlow_0mew9im</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" /> - <bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_SetupCompleteMsoProcess" /> + <bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_UpdateRequestComplete" /> </bpmn:process> <bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -205,9 +193,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB"> - <dc:Bounds x="1281" y="147" width="36" height="36" /> + <dc:Bounds x="1085" y="147" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1291" y="186" width="18" height="12" /> + <dc:Bounds x="1094" y="127" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp"> @@ -257,26 +245,15 @@ <bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync"> <dc:Bounds x="46" y="-7" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_SetupCompleteMsoProcess"> - <dc:Bounds x="900" y="210" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1jxi5jq_di" bpmnElement="Call_CompleteMsoProcess"> - <dc:Bounds x="1027" y="210" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete"> + <dc:Bounds x="942" y="206" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz"> - <di:waypoint xsi:type="dc:Point" x="1000" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1027" y="250" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="969" y="229" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1rscv7d_di" bpmnElement="SequenceFlow_1rscv7d"> - <di:waypoint xsi:type="dc:Point" x="1127" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1147" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1147" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1281" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1042" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1103" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1103" y="183" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1117" y="208" width="90" height="0" /> + <dc:Bounds x="1027.5" y="231" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_18226x4_di" bpmnElement="SubProcess_18226x4" isExpanded="true"> @@ -424,9 +401,11 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp"> <di:waypoint xsi:type="dc:Point" x="891" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1281" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1001" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1001" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="165" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1081" y="140" width="12" height="12" /> + <dc:Bounds x="1037.2153846153847" y="140" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1q8eh5e_di" bpmnElement="End_RollbackFailed"> @@ -558,10 +537,10 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen"> <di:waypoint xsi:type="dc:Point" x="866" y="190" /> - <di:waypoint xsi:type="dc:Point" x="866" y="250" /> - <di:waypoint xsi:type="dc:Point" x="900" y="250" /> + <di:waypoint xsi:type="dc:Point" x="866" y="246" /> + <di:waypoint xsi:type="dc:Point" x="942" y="246" /> <bpmndi:BPMNLabel> - <dc:Bounds x="872" y="220" width="18" height="12" /> + <dc:Bounds x="872" y="217.6" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index f9ff28a023..1e3f175cf1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -68,6 +68,7 @@ import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCUnassignTasks; import org.onap.so.bpmn.infrastructure.workflow.tasks.FlowCompletionTasks; import org.onap.so.bpmn.infrastructure.workflow.tasks.OrchestrationStatusValidator; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; import org.onap.so.bpmn.sdno.tasks.SDNOHealthCheckTasks; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; @@ -219,6 +220,9 @@ public abstract class BaseBPMNTest { @MockBean protected SniroHomingV2 sniroHoming; + + @MockBean + protected WorkflowActionBBFailure workflowActionBBFailure; @LocalServerPort protected int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index 5da6d3a577..3ab1c76ee6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -46,11 +46,10 @@ public class WorkflowActionBBTest extends BaseBPMNTest { Map<String, String> map = new HashMap<>(); map.put("handlingCode", "Success"); mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - mockSubprocess("CompleteMsoProcess", "Mocked CompleteMsoProcess", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_SetupCompleteMsoProcess", "Call_CompleteMsoProcess", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_UpdateRequestComplete", "End_WorkflowActionBB"); } @@ -92,7 +91,7 @@ public class WorkflowActionBBTest extends BaseBPMNTest { Map<String, String> map = new HashMap<>(); map.put("handlingCode", "Abort"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBTasks).abortCallErrorHandling(any(DelegateExecution.class)); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure).abortCallErrorHandling(any(DelegateExecution.class)); mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java index be49e3c681..dcf679610e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java @@ -33,14 +33,16 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ActivateNetworkBBTest extends BaseBPMNTest{ @Test public void sunnyDayActivateNetwork_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","Activate_Network_AAI_ServiceTask","activateNetwork_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","CallActivity_sdncHandler","Activate_Network_AAI_ServiceTask","activateNetwork_EndEvent"); assertThat(pi).isEnded(); } @Test public void rainyDayActivateNetwork_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); assertThat(pi).isStarted() diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index 14ff2fce9a..2c2777154d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -19,7 +19,7 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; @@ -27,7 +27,6 @@ import java.io.IOException; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -35,22 +34,21 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ActivateVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "CallActivity_sdncHandler", "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); assertThat(pi).isEnded(); } @Test - public void rainyDay() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); assertThat(pi).isNotNull().isStarted() .hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "UpdateVfModuleActiveStatus") .hasNotPassed("ActivateVfModuleBB_End"); - - } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java index 7a8838e9fd..d1d95fee71 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java @@ -30,10 +30,11 @@ import org.onap.so.bpmn.BaseBPMNTest; public class ActivateVnfBBTest extends BaseBPMNTest{ @Test public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate", - "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB"); + "CallActivity_sdncHandler", "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java index ee76eefd2c..c581a16349 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java @@ -34,16 +34,16 @@ public class AssignNetworkBBTest extends BaseBPMNTest{ @Test @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"}) public void sunnyDayAssignNetwork_Test() throws InterruptedException { - + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","networkFoundByName_ExclusiveGateway","ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","ServiceTask_assign_network_aai","AssignNetworkBB_end"); + assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","networkFoundByName_ExclusiveGateway","ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","CallActivity_sdncHandlerCall","ServiceTask_assign_network_aai","AssignNetworkBB_end"); assertThat(pi).isEnded(); } @Test public void rainyDayAssignNetwork_Test() throws Exception { - + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java index 078f101347..2624cc0ccb 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java @@ -31,10 +31,11 @@ public class AssignServiceInstanceBBTest extends BaseBPMNTest{ @Test public void sunnyDaySDNC() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance", - "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", + "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", "CallActivity_sdncHandler", "Task_UpdateServiceOstatusToAssigned", "End_AssignServiceInstanceBB"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java index 567d57cbc9..44d17a350c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java @@ -32,12 +32,14 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class AssignVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDayAssignVfModule_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule", "ConnectVfModuleToVolumeGroup", "AssignVfModule", + "CallActivity_sdncHandlerCall", "UpdateVfModuleStatus", "AssignVfModuleBB_End"); assertThat(pi).isEnded(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java index f675440ead..f4258f46b8 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java @@ -38,7 +38,7 @@ public class AssignVnfBBTest extends BaseBPMNTest { mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "ServiceTask_ConnectVnfToCloudRegion", "ServiceTask_ConnectVnfToTenant", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign","CallActivity_sdncAssign", "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); assertThat(pi).isEnded(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java index 2e0b813b36..1772a3af4b 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java @@ -32,9 +32,10 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ChangeModelServiceInstanceBBTest extends BaseBPMNTest{ @Test public void changeModelVnfBBTest() { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start" ,"SDNCChangeModelServiceInstance", "AAIUpdateModelServiceInstance", "ChangeModelServiceInstance_End"); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start" ,"SDNCChangeModelServiceInstance", "CallActivity_sdncHandlerReq", "AAIUpdateModelServiceInstance", "ChangeModelServiceInstance_End"); assertThat(processInstance).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java index fca6aae107..8549b6bc5a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java @@ -32,9 +32,10 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ChangeModelVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDayChangeModelVfModuleTest() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End"); + assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", "CallActivity_sdncHandler", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java index 50dc25d081..43ac1630df 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java @@ -32,9 +32,10 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ChangeModelVnfBBTest extends BaseBPMNTest{ @Test public void changeModelVnfBBTest() { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start" ,"SDNCChangeModel", "AAIUpdateModel", "ChangeModelVnf_End"); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start" ,"SDNCChangeModel", "CallActivity_sdncHandlerCall", "AAIUpdateModel", "ChangeModelVnf_End"); assertThat(processInstance).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java index 02903cd00f..ad93eec514 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java @@ -32,14 +32,16 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeactivateNetworkBBTest extends BaseBPMNTest{ @Test public void sunnyDayDeactivateNetworkBB_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", "DeactivateNetworkAAI", "DeactivateNetworkBB_End"); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", "CallActivity_sdncHandler","DeactivateNetworkAAI", "DeactivateNetworkBB_End"); assertThat(pi).isEnded(); } @Test public void rainyDayDeactivateNetworkBB_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks).deactivateNetwork(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java index 2bf6377a71..428713d9a7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java @@ -19,15 +19,11 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doThrow; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; /** * Unit test cases for DeActivateServiceInstanceTest.bpmn @@ -35,9 +31,10 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeactivateServiceInstanceBBTest extends BaseBPMNTest{ @Test public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", "Task_DeactivateServiceInstance_SDNC", "Task_DeactivateServiceInstance_AAI", "End_DeactivateServiceInstanceBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", "Task_DeactivateServiceInstance_SDNC", "CallActivity_sdncHandler", "Task_DeactivateServiceInstance_AAI", "End_DeactivateServiceInstanceBB"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java index ef04d716fb..c7232e504e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java @@ -34,15 +34,17 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeactivateVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "CallActivity_sdncHandler", "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End"); assertThat(pi).isEnded(); } @Test public void rainyDay() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusDeactivateVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java index 22cdfbb25a..bf5e228cbf 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java @@ -34,10 +34,11 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeactivateVnfBBTest extends BaseBPMNTest{ @Test public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB","Task_SDNCAdapterVnfTopologyDeactivate", - "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); + "CallActivity_sdncHandler", "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); assertThat(pi).isEnded(); } @@ -54,6 +55,7 @@ public class DeactivateVnfBBTest extends BaseBPMNTest{ @Test public void rainyDayDeactivateVnfAAIError_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedVnf(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index b88bb3a309..d9190b5e12 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -33,11 +33,12 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeleteVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter", - "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -48,7 +49,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter") - .hasNotPassed("VnfAdapter", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java index cd6c266ba4..2336bb54ca 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java @@ -35,7 +35,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest { mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); assertThat(pi).isEnded(); } @@ -46,7 +46,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI") + .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI") .hasNotPassed("DeleteVolumeGroupBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java index b065ba092c..442d7b72c4 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java @@ -33,14 +33,16 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class UnassignNetworkBBTest extends BaseBPMNTest { @Test public void sunnyDayAssignNetwork_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","CallActivity_sdncHandlerCall","Task_DeleteNetwork","End_UnassignNetworkBB"); assertThat(pi).isEnded(); } @Test public void rainyDayAssignNetwork_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java index f8eddab4c9..854c4f9c2e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java @@ -31,13 +31,12 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; public class UnassignServiceInstanceBBTest extends BaseBPMNTest{ @Test public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); BuildingBlockExecution bbe = new DelegateExecutionImpl(new ExecutionImpl()); - variables.put("gBuildingBlockExecution", bbe); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignServiceInstanceBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", "Task_SdncUnassignServiceInstance", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", "Task_SdncUnassignServiceInstance", "CallActivity_sdncHandlerCall", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java index 90955e3ac5..89089770b1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java @@ -32,10 +32,12 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class UnassignVfModuleBBTest extends BaseBPMNTest{ @Test public void sunnyDayUnassignVfModule_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule", + "CallActivity_sdncHandler", "DeleteVfModule", "UnassignVfModuleBB_End"); assertThat(pi).isEnded(); @@ -43,6 +45,7 @@ public class UnassignVfModuleBBTest extends BaseBPMNTest{ @Test public void rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); assertThat(pi).isNotNull(); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java index 57d2ac5170..d508f4fcd7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java @@ -33,10 +33,12 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class UnassignVnfBBTest extends BaseBPMNTest{ @Test public void sunnyDayUnassignVnf_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", + "CallActivity_sdncHandlerCall", "DeleteVnfInstanceGroups", "DeleteVnf", "UnassignVnfBB_End"); @@ -56,6 +58,7 @@ public class UnassignVnfBBTest extends BaseBPMNTest{ @Test public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVnf(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); assertThat(pi).isNotNull().isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups","DeleteVnf") diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index b29017ea8d..9ba278a119 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -308,5 +308,14 @@ <version>${camunda.springboot.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.camunda.bpm.extension.mockito</groupId> + <artifactId>camunda-bpm-mockito</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index 2ae7686703..05fd517e47 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.json.JSONArray import org.json.JSONObject import org.json.XML +import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil @@ -381,7 +382,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceName", '"' + serviceName + '"') valueMap.put("serviceUuId", '"' + serviceUuId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() // insert CallSource='ExternalAPI' to uuiRequest Map<String, String> requestInputsMap = new HashMap<>() @@ -426,7 +427,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() execution.setVariable("ServiceOrderId", "") Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) @@ -471,7 +472,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso extAPIPath += "/" + execution.getVariable("ServiceOrderId") msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index a505f3ff5e..b2c278b64c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -538,8 +538,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } private def getInstnaceId(DelegateExecution execution) { - def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) - def data = responce.toString() + def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) + def data = response.toString() data = data.substring(data.indexOf("<")) def resp = new XmlSlurper().parseText(data) @@ -548,11 +548,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { def val = "" switch (modelName) { - case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : - case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : - val = resp."network-response-information"."instance-id" - break - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : case ~/[\w\s\W]*Site[\w\s\W]*/: @@ -563,6 +558,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: val = resp."connection-attachment-response-information"."instance-id" break + + // for SDWANConnectivity and SOTNConnectivity and default: + default: + val = resp."network-response-information"."instance-id" + break } return val.toString() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index e3702f1014..6222214108 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -29,10 +30,9 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.core.UrnPropertiesReader -import groovy.json.* import javax.ws.rs.core.Response import org.onap.so.utils.TargetEntity @@ -43,11 +43,6 @@ import org.onap.so.utils.TargetEntity public class CreateVFCNSResource extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class); - - String vfcUrl = "/vfc/rest/v1/vfcadapter" - - String host = "http://mso.mso.testlab.openecomp.org:8080" - ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -116,6 +111,18 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { execution.setVariable("nsParameters", nsParameters) execution.setVariable("nsServiceModelUUID", nsServiceModelUUID); + String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution) + + if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { + msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' + msoLogger.debug(msg) + } + + while (vfcAdapterUrl.endsWith('/')) { + vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1) + } + + execution.setVariable("vfcAdapterUrl", vfcAdapterUrl) } catch (BpmnError e) { throw e; @@ -132,6 +139,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { */ public void createNetworkService(DelegateExecution execution) { msoLogger.trace("createNetworkService ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID"); String nsParameters = execution.getVariable("nsParameters"); @@ -149,8 +157,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { "additionalParamForNs":${requestInputs} } }""" - Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatus() + Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatus () String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; if(returnCode== "200" || returnCode == "201"){ @@ -165,6 +173,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { */ public void instantiateNetworkService(DelegateExecution execution) { msoLogger.trace("instantiateNetworkService ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); String nsServiceName = execution.getVariable("nsServiceName") @@ -176,7 +185,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { "nsParameters":${nsParameters} }""" String nsInstanceId = execution.getVariable("nsInstanceId") - String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" + String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate" Response apiResponse = postRequest(execution, url, reqBody) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) @@ -193,9 +202,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { */ public void queryNSProgress(DelegateExecution execution) { msoLogger.trace("queryNSProgress ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + jobId + String url = vfcAdapterUrl + "/jobs/" + jobId Response apiResponse = postRequest(execution, url, nsOperationKey) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) @@ -214,7 +224,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { try { Thread.sleep(5000); } catch(InterruptedException e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + msoLogger.error( "Time Delay exception" + e.getMessage()); } } @@ -239,7 +249,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { getAAIClient().connect(nsUri,relatedServiceUri) msoLogger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e); + msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage()); throw new BpmnError("MSOWorkflowException") } } @@ -251,24 +261,30 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { */ private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody) Response apiResponse = null try{ - URL url = new URL(urlString); - - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) - httpClient.addAdditionalHeader("Accept", "application/json") - httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + URL url = new URL(urlString); + + // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' + // user 'bepl' authHeader is the same with mso.db.auth + String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) - apiResponse = httpClient.post(requestBody) + apiResponse = httpClient.post(requestBody) + + msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) - msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) - msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); - throw new BpmnError("MSOWorkflowException") - } + msoLogger.error("VFC Aatpter Post Call Exception:" + e.getMessage()); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception") + } + + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + return apiResponse } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 9c25a57adc..af46bf65b8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory + import static org.apache.commons.lang3.StringUtils.*; import org.camunda.bpm.engine.delegate.BpmnError @@ -55,8 +57,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) - CatalogDbUtils cutils = new CatalogDbUtils() - AAICreateResources aaiCR = new AAICreateResources() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() /** * This method gets and validates the incoming @@ -448,7 +449,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) - JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, + JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") msoLogger.debug("obtained VNF list: " + vnfs) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 078d68bd75..b718e4a2e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory + import javax.ws.rs.NotFoundException import javax.ws.rs.core.Response @@ -249,7 +251,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceName", "null") valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() valueMap.put("_requestInputs_", "") @@ -271,7 +273,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) @@ -317,7 +319,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() execution.setVariable("ServiceOrderId", "") Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) @@ -361,7 +363,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso extAPIPath += "/" + execution.getVariable("ServiceOrderId") msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index 519f064802..5bb8c83628 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -52,7 +52,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteCustomE2EServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -111,7 +110,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationType", "DELETE") } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.info(msg) @@ -121,7 +120,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("Staring sendSyncResponse") try { @@ -166,7 +164,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("Starting prepareCompletion") try { @@ -339,8 +336,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor * Init the service Operation Status */ public void prepareInitServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + msoLogger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -349,12 +345,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String progress = "0" String reason = "" String operationContent = "Prepare service creation" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -376,12 +372,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + msoLogger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } - utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + msoLogger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 9c9ed933e0..24071d38f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -20,42 +20,14 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceInstance -import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.Resource -import org.onap.so.bpmn.core.domain.AllottedResource -import org.onap.so.bpmn.core.domain.NetworkResource -import org.onap.so.bpmn.core.domain.VnfResource -import org.onap.so.bpmn.common.recipe.ResourceInput -import org.onap.so.bpmn.common.recipe.BpmnRestClient import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.common.scripts.CatalogDbUtils; -import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException -import java.util.List; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - - /** * This groovy class supports the <class>DoCompareModelVersions.bpmn</class> process. @@ -76,7 +48,6 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { String Prefix="DCMPMDV_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 194e7ff3e1..2168dab736 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -24,12 +24,10 @@ import static org.apache.commons.lang3.StringUtils.*; import javax.ws.rs.NotFoundException -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.CatalogDbUtils; import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.RollbackData @@ -37,7 +35,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper @@ -50,10 +47,6 @@ import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import groovy.json.* - - - /** * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process. * @@ -86,7 +79,6 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DCRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() public void preProcessRequest (DelegateExecution execution) { String msg = "" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index c9497165c4..1b64671163 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -527,6 +527,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get() execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + execution.setVariable(Prefix + "requeryIdAAIResponse", network) String netName = network.getNetworkName() String networkOutputs = @@ -764,29 +765,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) + msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) try { // get variables String networkId = execution.getVariable(Prefix + "networkId") - String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + L3Network requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") L3Network l3Network = new L3Network() - if (utils.nodeExists(requeryIdAAIResponse, 'heat-stack-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getHeatStackId())) { if (utils.nodeExists(createNetworkResponse, 'networkStackId')) { l3Network.setHeatStackId(utils.getNodeText(createNetworkResponse, 'networkStackId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'neutron-network-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getNeutronNetworkId())) { if (utils.nodeExists(createNetworkResponse, 'neutronNetworkId')) { l3Network.setNeutronNetworkId(utils.getNodeText(createNetworkResponse, 'neutronNetworkId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'contrail-network-fqdn')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getContrailNetworkFqdn())) { if (utils.nodeExists(createNetworkResponse, 'networkFqdn')) { l3Network.setContrailNetworkFqdn(utils.getNodeText(createNetworkResponse, 'networkFqdn')) } @@ -794,39 +792,33 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(createNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } + msoLogger.debug("Updating l3-network in AAI" ) + AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) client.update(uri, l3Network) - String subnetsXml = utils.getNodeXml(requeryIdAAIResponse, "subnets") - InputSource source = new InputSource(new StringReader(subnetsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(source) - NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() - String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() + if(requeryIdAAIResponse.getSubnets() != null){ + for(Subnet s:requeryIdAAIResponse.getSubnets().getSubnet()){ + String subnetOrchStatus = s.getOrchestrationStatus() + String subnetId = s.getSubnetId() Subnet subnet = new Subnet() - String neutronSubnetId = networkUtils.extractNeutSubId(createNetworkResponse, subnetId) - subnet.setNeutronSubnetId(neutronSubnetId) + subnet.setNeutronSubnetId(networkUtils.extractNeutSubId(createNetworkResponse, subnetId)) if(subnetOrchStatus.equals("pending-create") || subnetOrchStatus.equals("PendingCreate") ){ subnet.setOrchestrationStatus("Created") }else{ subnet.setOrchestrationStatus("Active") } + msoLogger.debug("Updating subnet in AAI" ) AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) client.update(subUri, subnet) + } } @@ -868,7 +860,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String source = execution.getVariable(Prefix + "source") String requestInput = execution.getVariable(Prefix + "networkRequest") - String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") + L3Network queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index 1d75d399ee..fd6a4a1cde 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -18,17 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.logger.MsoLogger -import org.onap.so.logger.MessageEnum - import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NetworkUtils @@ -37,13 +34,9 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.utils.TargetEntity -import java.util.UUID; import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils /** * This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process. @@ -203,7 +196,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) URL url = new URL(urlRollbackPoNetwork) - HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(rollbackNetworkRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 7707903391..aa1eed95bb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -20,21 +20,12 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.infrastructure.properties.BPMNProperties - -import java.util.ArrayList -import java.util.Iterator -import java.util.List import org.apache.commons.lang3.StringUtils import org.apache.http.HttpResponse import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.codehaus.groovy.runtime.ArrayUtil -import org.codehaus.groovy.runtime.ScriptBytecodeAdapter -import org.codehaus.groovy.runtime.callsite.CallSite -import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation -import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling -import org.json.JSONArray import org.json.JSONObject import org.onap.so.bpmn.common.recipe.BpmnRestClient import org.onap.so.bpmn.common.recipe.ResourceInput @@ -48,7 +39,6 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger @@ -75,7 +65,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() public void preProcessRequest(DelegateExecution execution) { msoLogger.trace("preProcessRequest ") @@ -260,18 +250,17 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ // requestAction is action, not opertiontype //String requestAction = resourceInput.getOperationType() String requestAction = "createInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceModelUUID, requestAction) + JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, resourceModelUUID, requestAction) if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + resourceRecipe.getString("orchestrationUri") int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") String recipeParamXsd = resourceRecipe.get("paramXSD") BpmnRestClient bpmnRestClient = new BpmnRestClient() HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd) } else { - String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + - resourceInput.getResourceModelInfo().getModelUuid() + String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID msoLogger.trace(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 4bda803da0..c04bbd4806 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -22,13 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.OwningEntity -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils @@ -42,16 +41,11 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.* - /** * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process. * @@ -84,7 +78,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DCRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -330,7 +324,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String modelInvariantUuid = execution.getVariable("modelInvariantUuid") try{ - String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) msoLogger.debug("JSON IS: "+json) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index a3c30dcb50..33d0e25d7d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -31,10 +32,10 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.utils.TargetEntity -import groovy.json.* import javax.ws.rs.core.Response /** @@ -44,9 +45,6 @@ import javax.ws.rs.core.Response public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class); - String vfcUrl = "/vfc/rest/v1/vfcadapter" - - String host = "http://mso.mso.testlab.openecomp.org:8080" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -100,6 +98,19 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces execution.setVariable("nsOperationKey", nsOperationKey); execution.setVariable("nsParameters", nsParameters) + String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution) + + if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { + msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' + msoLogger.debug(msg) + } + + while (vfcAdapterUrl.endsWith('/')) { + vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1) + } + + execution.setVariable("vfcAdapterUrl", vfcAdapterUrl) + } catch (BpmnError e) { throw e; @@ -116,6 +127,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void createNetworkService(DelegateExecution execution) { msoLogger.trace("createNetworkService") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); String nsServiceName = execution.getVariable("nsServiceName") @@ -126,7 +138,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces "nsOperationKey":${nsOperationKey}, "nsParameters":${nsParameters} }""" - Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; @@ -142,6 +154,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void instantiateNetworkService(DelegateExecution execution) { msoLogger.trace("instantiateNetworkService") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); String nsServiceName = execution.getVariable("nsServiceName") @@ -153,7 +166,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces "nsParameters":${nsParameters} }""" String nsInstanceId = execution.getVariable("nsInstanceId") - String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" + String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate" Response apiResponse = postRequest(execution, url, reqBody) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) @@ -170,9 +183,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void queryNSProgress(DelegateExecution execution) { msoLogger.trace("queryNSProgress") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + jobId + String url = vfcAdapterUrl + "/jobs/" + jobId Response apiResponse = postRequest(execution, url, nsOperationKey) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) @@ -233,17 +247,20 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces try{ URL url = new URL(urlString); + + // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' + // user 'bepl' authHeader is the same with mso.db.auth + String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) - httpClient.addAdditionalHeader("Accept", "application/json") - httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") - - apiResponse = httpClient.post(requestBody) + apiResponse = httpClient.post(requestBody) msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ()); throw new BpmnError("MSOWorkflowException") } return apiResponse diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 50fe75e3df..089239fa07 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -20,6 +20,9 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.client.HttpClientFactory + import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response import javax.xml.parsers.DocumentBuilder @@ -42,9 +45,7 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.VnfResource -import org.onap.so.bpmn.core.json.DecomposeJsonUtil import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.client.HttpClient import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIObjectType; @@ -59,7 +60,6 @@ import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.TargetEntity -import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.NamedNodeMap @@ -78,8 +78,8 @@ public class DoCreateVfModule extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - CatalogDbUtils catalog = new CatalogDbUtils() - DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + private final HttpClientFactory httpClientFactory = new HttpClientFactory() /** * Validates the request message and sets up the workflow. @@ -261,7 +261,7 @@ public class DoCreateVfModule extends VfModuleBase { String serviceType ="" try{ - String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") }catch(BpmnError e){ throw e @@ -642,7 +642,7 @@ public class DoCreateVfModule extends VfModuleBase { String endPoint = aaiUriUtil.createAaiUri(uri) try { - HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) @@ -724,7 +724,7 @@ public class DoCreateVfModule extends VfModuleBase { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName) String endPoint = aaiUriUtil.createAaiUri(uri) - HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) @@ -2004,7 +2004,7 @@ public class DoCreateVfModule extends VfModuleBase { msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) - JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") + JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid) // Only one match here diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index 93379c72be..b42962adac 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VolumeGroup +import org.onap.aai.domain.yang.VolumeGroups import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -216,10 +217,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { try { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName) - Optional<VolumeGroup> volumeGroup = getAAIClient().get(VolumeGroup.class,uri) - if(volumeGroup.isPresent()){ + Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri) + if(volumeGroups.isPresent()){ + VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0); execution.setVariable(prefix+'AaiReturnCode', 200) - execution.setVariable("queriedVolumeGroupId",volumeGroup.get().getVolumeGroupId()) + execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId()) msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.") }else{ execution.setVariable(prefix+'AaiReturnCode', 404) @@ -298,6 +300,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { getAAIClient().create(volumeGroupUri, volumeGroup) getAAIClient().connect(volumeGroupUri, vnfUri) getAAIClient().connect(volumeGroupUri, tenantUri) + execution.setVariable("queriedVolumeGroupId", volumeGroupId) RollbackData rollbackData = execution.getVariable("rollbackData") rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true") } catch (NotFoundException ignored) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index d3dbd9107e..232336b0ee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -20,14 +20,11 @@ package org.onap.so.bpmn.infrastructure.scripts -import java.util.UUID; - -import java.util.List - import org.json.JSONObject; import org.json.JSONArray; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.RollbackData @@ -59,7 +56,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) - CatalogDbUtils cutils = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() /** * This method gets and validates the incoming @@ -189,8 +186,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) - JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, - vnfModelCustomizationUuid) + JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, + vnfModelCustomizationUuid, "v1") msoLogger.debug("obtained VNF list") // Only one match here JSONObject vnfObject = vnfs[0] diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index a981abf011..48f255bf91 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -19,37 +19,35 @@ */ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import javax.ws.rs.core.Response -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.apache.commons.lang3.* +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject - import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.UrnPropertiesReader - -import org.onap.so.utils.TargetEntity import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.MsoLogger +import org.onap.so.utils.TargetEntity 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 -import groovy.json.* +import javax.ws.rs.core.Response +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import static org.apache.commons.lang3.StringUtils.isBlank /** * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process. @@ -78,10 +76,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DDEESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteE2EServiceInstance.class); + public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + msoLogger.debug(" ***** preProcessRequest *****") String msg = "" try { @@ -107,23 +106,23 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { + + if (paramsMap != null) { sbParams.append("<service-input-parameters>") for (Map.Entry<String, String> entry : paramsMap.entrySet()) { String paramsXml @@ -148,15 +147,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + msoLogger.debug("***** Exit preProcessRequest *****") } public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + msoLogger.debug(" ***** postProcessAAIGET ***** ") String msg = "" try { @@ -165,14 +163,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceType = "" if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + msoLogger.debug("Found Service-instance in AAI") String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) + msoLogger.debug("SI Data") if (isBlank(siData)) { msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else @@ -185,7 +183,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // get model invariant id // 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) + msoLogger.debug("SI Data model-invariant-id and model-version-id exist") def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() @@ -194,10 +192,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("model-version-id-original", modelVersionId) } - utils.log("INFO", "SI Data" + siData, isDebugEnabled) + msoLogger.debug("SI Data" + siData) //Confirm there are no related service instances (vnf/network or volume) if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) + msoLogger.debug("SI Data relationship-list exists") JSONArray jArray = new JSONArray() XmlParser xmlParser = new XmlParser() @@ -211,109 +209,35 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } execution.setVariable("serviceRelationShip", jArray.toString()) - -// //test(siData) -// NodeList nodeList = serviceXml.getElementsByTagName("relationship") -// JSONArray jArray = new JSONArray() -// for (int x = 0; x < nodeList.getLength(); x++) { -// Node node = nodeList.item(x) -// if (node.getNodeType() == Node.ELEMENT_NODE) { -// Element eElement = (Element) node -// def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns -// if(e.equals("service-instance")){ -// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() -// utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) -// NodeList dataList = node.getChildNodes() -// if(null != dataList) { -// JSONObject jObj = new JSONObject() -// for (int i = 0; i < dataList.getLength(); i++) { -// Node dNode = dataList.item(i) -// if(dNode.getNodeName() == "relationship-data") { -// Element rDataEle = (Element)dNode -// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() -// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() -// if(eKey.equals("service-instance.service-instance-id")){ -// jObj.put("resourceInstanceId", eValue) -// } -// -// } -// else if(dNode.getNodeName() == "related-to-property"){ -// Element rDataEle = (Element)dNode -// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() -// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() -// if(eKey.equals("service-instance.service-instance-name")){ -// jObj.put("resourceType", eValue) -// } -// } -// } -// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) -// jArray.put(jObj) -// } -// //for overlay/underlay -// }else if (e.equals("configuration")){ -// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() -// utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) -// NodeList dataList = node.getChildNodes() -// if(null != dataList) { -// JSONObject jObj = new JSONObject() -// for (int i = 0; i < dataList.getLength(); i++) { -// Node dNode = dataList.item(i) -// if(dNode.getNodeName() == "relationship-data") { -// Element rDataEle = (Element)dNode -// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() -// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() -// if(eKey.equals("configuration.configuration-id")){ -// jObj.put("resourceInstanceId", eValue) -// } -// } -// else if(dNode.getNodeName() == "related-to-property"){ -// Element rDataEle = (Element)dNode -// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() -// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() -// if(eKey.equals("configuration.configuration-type")){ -// jObj.put("resourceType", eValue) -// } -// } -// } -// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) -// jArray.put(jObj) -// } -// // for SP-Partner -// }else if (e.equals("sp-partner")){ -// -// } -// } -// } -// execution.setVariable("serviceRelationShip", jArray.toString()) + execution.setVariable("serviceRelationShip", jArray.toString()) } } }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + msoLogger.debug("Error getting Service-instance from AAI :" + serviceInstanceId) WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) if(workflowException != null){ + msoLogger.error("workflowException: " + workflowException) exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } - else - { + else { msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + msoLogger.debug("Service-instance NOT found in AAI. Silent Success") } }catch (BpmnError e) { - throw e; + throw e } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + msoLogger.debug(" *** Exit postProcessAAIGET *** ") } private JSONObject getRelationShipData(node, isDebugEnabled){ @@ -323,7 +247,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def rt = utils.getNodeText(relation, "related-to") def rl = utils.getNodeText(relation, "related-link") - utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) + msoLogger.debug("ServiceInstance Related NS/Configuration :" + rl) def rl_datas = utils.getIdenticalChildren(node, "relationship-data") for(def rl_data : rl_datas) { @@ -357,13 +281,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - + msoLogger.debug("Relationship related to Resource:" + jObj.toString()) return jObj } public void getCurrentNS(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentNSIndex") @@ -375,14 +297,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("GENGS_serviceInstanceId", "") execution.setVariable("GENGS_serviceInstanceName", nsResourceType) - utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled) + msoLogger.debug("======== COMPLETED getCurrentNS Process ======== ") } public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) + msoLogger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ") String modelInvariantUuid = execution.getVariable("model-invariant-id-original") String modelVersionId = execution.getVariable("model-version-id-original") @@ -393,10 +313,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) + msoLogger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + msoLogger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -415,23 +336,20 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) + msoLogger.debug(" ***** Started getRelatedResourceInAAI *****") -// AaiUtil aaiUriUtil = new AaiUtil() -// String aai_endpoint = execution.getVariable("URN_aai_endpoint") String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String urlLink = jObj.get("resourceLinkUrl") String serviceAaiPath = "${aai_endpoint}${urlLink}" URL url = new URL(serviceAaiPath) - HttpClient client = new HttpClient(url, "application/xml", TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI) Response response = client.get() int responseCode = response.getStatus() execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode) - utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled) + msoLogger.debug(" Get RelatedResource code is: " + responseCode) String aaiResponse = response.readEntity(String.class) execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) @@ -440,7 +358,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled) + msoLogger.debug("GET RelatedResource Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) @@ -460,20 +378,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { jObj.put("modelVersionId", modelUuid) jObj.put("modelCustomizationId", modelCustomizationId) } - else - { - utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) - } - - utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled) - return jObj; + else { + String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode + msoLogger.error(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.debug(" ***** Exit getRelatedResourceInAAI *****") + return jObj } public void postDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) + msoLogger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") @@ -527,19 +443,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid) - utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) + msoLogger.debug("delete resource list : " + deleteRealResourceList) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) + msoLogger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) } public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -549,7 +463,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = "0" String reason = "" String operationContent = "Prepare service creation" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -580,19 +494,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + msoLogger.debug("Outgoing initResourceOperationStatus: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + msoLogger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + msoLogger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ") } public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -606,7 +519,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -628,13 +541,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + msoLogger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage()) } - utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + msoLogger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ") } /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index ca4643dea0..c95704e51a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -34,6 +34,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.Relationships @@ -449,7 +450,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") URL url = new URL(vnfAdapterUrl) - HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(vnfAdapterRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 122cc08e89..6a31095920 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -20,6 +20,8 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory + import static org.apache.commons.lang3.StringUtils.isBlank import org.apache.commons.lang3.StringUtils @@ -65,11 +67,10 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String Prefix="DDR_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + msoLogger.debug(" ***** preProcessRequest *****") String msg = "" try { @@ -79,8 +80,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { //Inputs //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { + if (globalSubscriberId == null) { execution.setVariable("globalSubscriberId", "") } @@ -95,18 +95,18 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -136,16 +136,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + msoLogger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + msoLogger.debug(" ***** Exit preProcessRequest *****",) } public void sequenceResource(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED sequenceResource Process ======== ") List<Resource> sequencedResourceList = new ArrayList<Resource>() List<Resource> wanResources = new ArrayList<Resource>() @@ -198,18 +196,15 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) - utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) + msoLogger.debug("resourceSequence: " + resourceSequence) + msoLogger.debug(" ======== END sequenceResource Process ======== ") } /** * prepare delete parameters */ public void preResourceDelete(DelegateExecution execution){ - - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED preResourceDelete Process ======== ") List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") @@ -221,14 +216,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() execution.setVariable("resourceInstanceId", resourceInstanceUUID) execution.setVariable("currentResource", curResource) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + msoLogger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName()) } else { execution.setVariable("resourceInstanceId", "") } - utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== END preResourceDelete Process ======== ") } @@ -236,8 +231,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { * Execute delete workflow for resource */ public void executeResourceDelete(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled) + msoLogger.debug("======== Start executeResourceDelete Process ======== ") try { String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -247,7 +241,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { Resource currentResource = execution.getVariable("currentResource") String action = "deleteInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) + JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) String recipeUri = resourceRecipe.getString("orchestrationUri") int recipeTimeout = resourceRecipe.getInt("recipeTimeout") String recipeParamXsd = resourceRecipe.get("paramXSD") @@ -269,20 +263,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== END executeResourceDelete Process ======== ") }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + msoLogger.error("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) + msoLogger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") } } public void parseNextResource(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) + msoLogger.debug("======== Start parseNextResource Process ======== ") def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) @@ -292,7 +285,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { }else{ execution.setVariable("allResourceFinished", "false") } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) + msoLogger.debug("======== COMPLETED parseNextResource Process ======== ") } public void prepareFinishedProgressForResource(DelegateExecution execution) { @@ -340,8 +333,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { } public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + msoLogger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****") try { // get variables @@ -399,16 +391,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) + msoLogger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) + msoLogger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + msoLogger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index d855479694..6109d8631f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -26,12 +26,13 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.TargetEntity +import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response /** @@ -41,14 +42,10 @@ import javax.ws.rs.core.Response public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class); - - String vfcUrl = "/vfc/rest/v1/vfcadapter" - - String host = "http://mso.mso.testlab.openecomp.org:8080" - ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + private final HttpClientFactory httpClientFactory = new HttpClientFactory() /** * Pre Process the BPMN Flow Request @@ -83,6 +80,20 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces }""" execution.setVariable("nsOperationKey", nsOperationKey); msoLogger.info("nsOperationKey:" + nsOperationKey) + + String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution) + + if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { + msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' + msoLogger.debug(msg) + } + + while (vfcAdapterUrl.endsWith('/')) { + vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1) + } + + execution.setVariable("vfcAdapterUrl", vfcAdapterUrl) + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -123,8 +134,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void deleteNetworkService(DelegateExecution execution) { msoLogger.trace("deleteNetworkService start ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") Response apiResponse = deleteRequest(execution, url, nsOperationKey) String returnCode = apiResponse.getStatus() String operationStatus = "error"; @@ -142,8 +154,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void terminateNetworkService(DelegateExecution execution) { msoLogger.trace("terminateNetworkService start ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey") - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" + String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" Response apiResponse = postRequest(execution, url, nsOperationKey) String returnCode = apiResponse.getStatus() String aaiResponseAsString = apiResponse.readEntity(String.class) @@ -161,9 +174,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void queryNSProgress(DelegateExecution execution) { msoLogger.trace("queryNSProgress start ") + String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") + String url = vfcAdapterUrl + "/jobs/" + execution.getVariable("jobId") Response apiResponse = postRequest(execution, url, nsOperationKey) String returnCode = apiResponse.getStatus() String apiResponseAsString = apiResponse.readEntity(String.class) @@ -206,9 +220,12 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces try{ URL url = new URL(urlString); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) - httpClient.addAdditionalHeader("Accept", "application/json") - httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' + // user 'bepl' authHeader is the same with mso.db.auth + String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) + HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) apiResponse = httpClient.post(requestBody) @@ -216,7 +233,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); throw new BpmnError("MSOWorkflowException") } return apiResponse @@ -234,14 +251,18 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces try{ URL Url = new URL(url) - HttpClient httpClient = new HttpClient(Url, "application/json", TargetEntity.VNF_ADAPTER) - httpClient.addAdditionalHeader("Accept", "application/json") - httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' + // user 'bepl' authHeader is the same with mso.db.auth + String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) + HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) + r = httpClient.delete(requestBody) msoLogger.trace("Completed Execute VF-C adapter Delete Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); throw new BpmnError("MSOWorkflowException") } return r diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index a99f6e993e..19d30bb9b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -29,8 +29,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution import com.fasterxml.jackson.databind.ObjectMapper +import org.onap.so.client.HttpClientFactory + import javax.ws.rs.core.Response import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource @@ -201,7 +202,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try{ URL url = new URL(urlString); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") apiResponse = httpClient.post(requestBody) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index cc301db4cd..6dd8085bae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -721,9 +721,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(updateNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } AAIResourcesClient client = new AAIResourcesClient() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index f6a8a1558c..06c7002dff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -25,11 +25,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.common.scripts.VfModule import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException @@ -38,7 +38,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.entities.uri.AAIResourceUri @@ -46,14 +45,12 @@ import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.springframework.web.util.UriUtils - public class DoUpdateVfModule extends VfModuleBase { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils catalog = new CatalogDbUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() /** * Initialize the flow's variables. @@ -255,7 +252,7 @@ public class DoUpdateVfModule extends VfModuleBase { String serviceType ="" try{ - String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") }catch(BpmnError e){ throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 7fdbb5cb89..9eb05cf64a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -20,9 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; +import org.onap.so.client.HttpClientFactory -import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -30,21 +29,18 @@ import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ModuleResource import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.TargetEntity -import org.springframework.web.util.UriUtils; /** * This class supports the VID Flow @@ -163,7 +159,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', 'application/xml') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 1a47ef88e2..a8e3b2040b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -24,7 +24,6 @@ import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.CatalogDbUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils @@ -55,7 +54,6 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { 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. diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 7a6fd72a7d..7a40ef978b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -21,13 +21,10 @@ package org.onap.so.bpmn.vcpe.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.CatalogDbUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils -import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum @@ -40,10 +37,6 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException -import org.json.JSONObject - -import static org.apache.commons.lang3.StringUtils.isBlank - /** * This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process. @@ -60,7 +53,6 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() NetworkUtils networkUtils = new NetworkUtils() /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java index 209cbac98a..2268d22bd2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -21,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -32,15 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn + * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn * * Inputs: * - correlationId - String + * - pnfUuid - String */ @Component -public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { +public class CreatePnfEntryInAaiDelegate implements JavaDelegate { - private static final Logger logger = LoggerFactory.getLogger(CreateAaiEntryWithPnfIdDelegate.class); + private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class); private AaiConnection aaiConnection; @Autowired @@ -51,11 +55,11 @@ public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { String correlationId = (String) execution.getVariable(CORRELATION_ID); + String pnfUuid = (String) execution.getVariable(PNF_UUID); Pnf pnf = new Pnf(); - pnf.setInMaint(true); - pnf.setPnfId(correlationId); + pnf.setPnfId(pnfUuid); pnf.setPnfName(correlationId); aaiConnection.createEntry(correlationId, pnf); - logger.debug("AAI entry is created for pnf correlation id: {}", correlationId); + logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index b3f2f726a0..1407cb9211 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -30,4 +32,5 @@ public class ExecutionVariableNames { public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; public final static String DMAAP_MESSAGE = "dmaapMessage"; public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; + public final static String PNF_UUID = "pnfUuid"; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java new file mode 100644 index 0000000000..f5483e489e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class GeneratePnfUuidDelegate implements JavaDelegate { + + private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class); + + @Override + public void execute(DelegateExecution delegateExecution){ + UUID uuid = UUID.randomUUID(); + logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant()); + delegateExecution.setVariable(PNF_UUID, uuid.toString()); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index 94fb6a8674..e9b0bc77b2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -21,9 +23,11 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; import com.google.common.base.Strings; +import java.util.regex.Pattern; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -35,6 +39,8 @@ import org.springframework.stereotype.Component; @Component public class PnfCheckInputs implements JavaDelegate { + private static final Pattern UUID_PATTERN = Pattern + .compile("(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$"); private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); private String defaultTimeout; @@ -46,19 +52,37 @@ public class PnfCheckInputs implements JavaDelegate { @Override public void execute(DelegateExecution execution) { + validateCorrelationId(execution); + validatePnfUuid(execution); + validateTimeout(execution); + } + + private void validateCorrelationId(DelegateExecution execution) { String correlationId = (String) execution.getVariable(CORRELATION_ID); if (Strings.isNullOrEmpty(correlationId)) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); } + } + + private void validatePnfUuid(DelegateExecution execution) { + String pnfUuid = (String) execution.getVariable(PNF_UUID); + if (Strings.isNullOrEmpty(pnfUuid)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined"); + } + if (!UUID_PATTERN.matcher(pnfUuid).matches()) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID"); + } + } + + private void validateTimeout(DelegateExecution execution) { String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); if (Strings.isNullOrEmpty(timeout)) { LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); if (defaultTimeout == null) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, - "default timeoutForPnfEntryNotification value not defined"); + "default timeoutForPnfEntryNotification value not defined"); } execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); } } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index f29044456c..52f879b0ad 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -117,6 +117,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); } + finally { + getRequest.reset(); + } } private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 7f1c2fd9b1..ac341886ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -622,7 +622,9 @@ public class ServicePluginFactory { // in demo we have only one VPN. no cross VPNs, so get first item. Map<String, Object> returnRoute = getReturnRoute(returnList); Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources); - vpnRequestInputs.putAll(returnRoute); + if(null!=vpnRequestInputs) { + vpnRequestInputs.putAll(returnRoute); + } String newRequest = getJsonString(uuiObject); return newRequest; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy new file mode 100644 index 0000000000..9ee995e036 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy @@ -0,0 +1,118 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder + +import static org.mockito.Mockito.* +/** + * Copyright 2018 ZTE Corporation. + * + * 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. + */ +class CreateSDNCNetworkResourceTest extends GroovyTestCase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090) + + String Prefix = "CRESDNCRES_" + String sdncAdapterWorkflowResponse + + void init() { + MockitoAnnotations.initMocks(this) + sdncAdapterWorkflowResponse = """ + <sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapterworkflow:response-data> + <CallbackHeader> + <RequestId>726420e0-3962-4bf2-9655-aac82fc7055e</RequestId> + <ResponseCode>200</ResponseCode> + <ResponseMessage>OK</ResponseMessage> + </CallbackHeader> + <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><output xmlns="org:onap:sdnc:northbound:generic-resource"><response-message></response-message><ack-final-indicator>Y</ack-final-indicator><svc-request-id>726420e0-3962-4bf2-9655-aac82fc7055e</svc-request-id><network-response-information><instance-id>9fa732b8-2c54-4eba-926d-464d18c07474</instance-id><object-path>restconf/config/GENERIC-RESOURCE-API:services/service/a99deffb-12e2-4656-8cf2-2d2a996d0f52/service-data/networks/network/9fa732b8-2c54-4eba-926d-464d18c07474/network-data/</object-path></network-response-information><response-code>200</response-code><service-response-information><instance-id>a99deffb-12e2-4656-8cf2-2d2a996d0f52</instance-id></service-response-information></output></RequestData> + </sdncadapterworkflow:response-data> + </sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + + } + + private ResourceInput getResInputObj(String modelName) { + String resourceInput = "{\n" + + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" + + "\t\"resourceInstanceDes\": null,\n" + + "\t\"globalSubscriberId\": \"sdwandemo\",\n" + + "\t\"serviceType\": \"CCVPN\",\n" + + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" + + "\t\"serviceModelInfo\": {\n" + + "\t\t\"modelName\": \"WanConnectionSvc03\",\n" + + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" + + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" + + "\t\t\"modelVersion\": \"1.0\",\n" + + "\t\t\"modelCustomizationUuid\": \"\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"\",\n" + + "\t\t\"modelType\": \"\"\n" + + "\t},\n" + + "\t\"resourceModelInfo\": {\n" + + "\t\t\"modelName\": \"" + + modelName + + "\",\n" + + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" + + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" + + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + + "\t\t\"modelType\": \"\"\n" + + "\t},\n" + + "\t\"resourceInstancenUuid\": null,\n" + + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" + + "\t\"operationType\": \"createInstance\",\n" + + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" + + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" + + "}" + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + return resourceInputObj + } + + @Test + void testAfterCreateSDNCCall() { + init() + checkGetInstanceId(getResInputObj("SotnFc-wan-connection")) + checkGetInstanceId(getResInputObj("SOTNConnectivity")) + checkGetInstanceId(getResInputObj("SDWANConnectivity")) + } + + private void checkGetInstanceId(ResourceInput input) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable(Prefix + "sdncCreateReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "SuccessIndicator")).thenReturn("false") + when(mockExecution.getVariable("isActivateRequired")).thenReturn("true") + when(mockExecution.getVariable("CRENWKI_createSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable(Prefix + "resourceInput")).thenReturn(input.toString()) + CreateSDNCNetworkResource createSDNCNetworkResource = new CreateSDNCNetworkResource() + createSDNCNetworkResource.afterCreateSDNCCall(mockExecution) + def instanceId = getInstanceId() + verify(mockExecution).setVariable("networkInstanceId", instanceId) + } + + private getInstanceId() { + def response = new XmlSlurper().parseText(sdncAdapterWorkflowResponse) + def data = response.toString() + data = data.substring(data.indexOf("<")) + def resp = new XmlSlurper().parseText(data) + def instanceId = resp."network-response-information"."instance-id" + return instanceId + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 11dbf7d2ee..7523427c84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,9 +43,11 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner +import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.junit.WireMockRule import org.apache.commons.lang3.* @@ -480,7 +482,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> <host-route> @@ -508,7 +510,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> </host-routes> @@ -1669,7 +1671,7 @@ String createNetworkRequest_Ipv4 = <notificationUrl/> </createNetworkRequest>""" -String createNetworkRequestAlaCarte = +String createNetworkRequestAlaCarte = """<createNetworkRequest> <cloudSiteId>RDM2WAGPLCP</cloudSiteId> <tenantId>7dd5365547234ee8937416c65507d266</tenantId> @@ -1874,8 +1876,8 @@ String createNetworkRequest_SRIOV = <serviceInstanceId/> </msoRequest> </networkRollback> -</rollbackNetworkRequest>""" - +</rollbackNetworkRequest>""" + String createNetworkResponse = """<ns2:createNetworkResponse xmlns:ns2="http://org.onap.so/network" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> @@ -3053,7 +3055,7 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) // JSON format when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") // 1610 default when(mockExecution.getVariable("disableRollback")).thenReturn(true) - + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -3182,8 +3184,8 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest) } - - + + @Test //@Ignore public void prepareCreateNetworkRequest_Ipv4() { @@ -3220,7 +3222,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_Ipv4) } - + @Test //@Ignore public void prepareCreateNetworkRequest_AlaCarte() { @@ -3712,7 +3714,7 @@ String sdncAdapterWorkflowAssignResponse = //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() //preDebugger.printInvocations(mockExecution) - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") @@ -3791,7 +3793,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") } - + @Test //@Ignore public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { @@ -4025,26 +4027,25 @@ String sdncAdapterWorkflowAssignResponse = @Test //@Ignore public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - + AAIResourcesClient mockClient = mock(AAIResourcesClient.class) WireMock.reset(); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + L3Network network = new L3Network() + //TODO need to inject mock ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(network) when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + doNothing().when(mockClient).update(isA(AAIResourceUri.class), isA(L3Network.class)) // preProcessRequest(DelegateExecution execution) DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) @@ -4102,7 +4103,7 @@ String sdncAdapterWorkflowAssignResponse = } - + @Test //@Ignore diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 26d3ab8d9d..53c164ab45 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -35,6 +35,7 @@ import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.Volume import org.onap.aai.domain.yang.VolumeGroup +import org.onap.aai.domain.yang.VolumeGroups import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.RollbackData import org.onap.so.client.aai.AAIObjectPlurals @@ -160,9 +161,11 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName) when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId) AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName) + VolumeGroups volumeGroups = new VolumeGroups(); VolumeGroup volumeGroup = new VolumeGroup() volumeGroup.setVolumeGroupId("volumeGroupId") - when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.of(volumeGroup)) + volumeGroups.getVolumeGroup().add(volumeGroup); + when(client.get(VolumeGroups.class,uri)).thenReturn(Optional.of(volumeGroups)) doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null) verify(mockExecution).setVariable("DCVFMODVOLV2_AaiReturnCode",200) } @@ -250,6 +253,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { when(mockExecution.getVariable(cloudOwner)).thenReturn(cloudOwner) when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) doCreateVfModuleVolumeV2.callRESTCreateAAIVolGrpName(mockExecution,null) + verify(mockExecution).setVariable("queriedVolumeGroupId", "volumeGroupId") } @Test diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java index 465dc085fc..0872060d55 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -20,31 +22,35 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; +import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Test; import org.onap.aai.domain.yang.Pnf; -public class CreateAaiEntryWithPnfIdDelegateTest { +public class CreatePnfEntryInAaiDelegateTest { @Test public void shouldSetPnfIdAndPnfName() throws Exception { // given - CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate(); + String pnfUuid = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); + CreatePnfEntryInAaiDelegate delegate = new CreatePnfEntryInAaiDelegate(); AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl(); delegate.setAaiConnection(aaiConnection); DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId"); + given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId"); + given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid); // when delegate.execute(execution); // then Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId"); - assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid); assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); - assertThat(createdEntry.isInMaint()).isTrue(); + assertThat(createdEntry.isInMaint()).isNull(); } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java index 863338548e..763a4546e8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. * ================================================================================ * 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. @@ -18,30 +18,26 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.client.restproperties; +package org.onap.so.bpmn.infrastructure.pnf.delegate; +import static org.assertj.core.api.Assertions.assertThat; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Test; -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.NoPrimitivesRule; -import com.openpojo.validation.rule.impl.NoPublicFieldsRule; -import com.openpojo.validation.test.impl.GetterTester; +public class GeneratePnfUuidDelegateTest { + private static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$"; -public class RestPropertiesPojoTest { - @Test - public void pojoStructure() { - test(PojoClassFactory.getPojoClass(AaiPropertiesConfiguration.class)); - } - - private void test(PojoClass pojoClass) { - Validator validator = ValidatorBuilder.create() - .with(new NoPrimitivesRule()) - .with(new NoPublicFieldsRule()) - .with(new GetterTester()) - .build(); - validator.validate(pojoClass); - } -} + @Test + public void execute_shouldSetValidUuidAsPnfUuid() { + // given + GeneratePnfUuidDelegate delegate = new GeneratePnfUuidDelegate(); + DelegateExecution execution = new DelegateExecutionFake(); + // when + delegate.execute(execution); + // then + assertThat((String) execution.getVariable(PNF_UUID)).matches(UUID_REGEX); + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index ab8d206a62..d670305a9a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -20,90 +22,101 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; +import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Rule; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; import org.junit.Test; -import org.junit.rules.ExpectedException; public class PnfCheckInputsTest { private static final String DEFAULT_TIMEOUT = "P1D"; + private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); + private static final String RESERVED_UUID = new UUID(0, 0).toString(); + + private DelegateExecution delegateExecution; - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DelegateExecution mockDelegateExecution() { - new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); - return delegateExecution; + @Before + public void setUp() { + delegateExecution = new DelegateExecutionFake(); + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); } @Test - public void shouldThrowException_whenPnfIdNotSet() { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecution(); - // when, then - expectedException.expect(BpmnError.class); - testedObject.execute(delegateExecution); + public void shouldThrowException_whenCorrelationIdNotSet() { + PnfCheckInputs testedObject = prepareExecutionForCorrelationId(null); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldThrowException_whenPnfIdIsEmptyString() throws Exception { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecution(); - when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn(""); - // when, then - expectedException.expect(BpmnError.class); - testedObject.execute(delegateExecution); + public void shouldThrowException_whenCorrelationIdIsEmptyString() { + PnfCheckInputs testedObject = prepareExecutionForCorrelationId(""); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } - private DelegateExecution mockDelegateExecutionWithCorrelationId() { - new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecution(); - when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); - return delegateExecution; + @Test + public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { + PnfCheckInputs testedObject = prepareExecutionForTimeout(null, null); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(null); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when, then - expectedException.expect(BpmnError.class); - testedObject.execute(delegateExecution); + public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() { + PnfCheckInputs testedObject = prepareExecutionForTimeout(null, ""); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() throws Exception { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(null); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - when(delegateExecution.getVariable(TIMEOUT_FOR_NOTIFICATION)).thenReturn(""); - // when, then - expectedException.expect(BpmnError.class); + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { + PnfCheckInputs testedObject = prepareExecutionForTimeout(DEFAULT_TIMEOUT, null); testedObject.execute(delegateExecution); + assertThat(delegateExecution.getVariable(TIMEOUT_FOR_NOTIFICATION)).isEqualTo(DEFAULT_TIMEOUT); } @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { - // given + public void shouldThrowException_whenPnfUuidIsNotSet() { + PnfCheckInputs testedObject = prepareExecutionForUuid(null); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldThrowException_whenPnfUuidIsEmptyString() { + PnfCheckInputs testedObject = prepareExecutionForUuid(""); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldThrowException_whenPnfUuidIsReservedUuid() { + PnfCheckInputs testedObject = prepareExecutionForUuid(RESERVED_UUID); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + private PnfCheckInputs prepareExecutionForCorrelationId(String correlationId) { PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when - testedObject.execute(delegateExecution); - // then - verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT)); + delegateExecution.setVariable(CORRELATION_ID, correlationId); + delegateExecution.setVariable(PNF_UUID, VALID_UUID); + return testedObject; + } + + private PnfCheckInputs prepareExecutionForTimeout(String defaultTimeout, String timeout) { + PnfCheckInputs testedObject = new PnfCheckInputs(defaultTimeout); + delegateExecution.setVariable(CORRELATION_ID, "testCorrelationId"); + delegateExecution.setVariable(PNF_UUID, VALID_UUID); + delegateExecution.setVariable(TIMEOUT_FOR_NOTIFICATION, timeout); + return testedObject; + } + + private PnfCheckInputs prepareExecutionForUuid(String uuid) { + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + delegateExecution.setVariable(CORRELATION_ID, "testCorrelationId"); + delegateExecution.setVariable(PNF_UUID, uuid); + return testedObject; } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn index e0b14ab0db..d8079174c1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -1,10 +1,10 @@ <?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.16.2"> +<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="2.0.3"> <bpmn:collaboration id="Collaboration_1d0w8lf"> <bpmn:participant id="Participant_1egg397" name="SO Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" /> <bpmn:participant id="Participant_0atuyq0" name="AAI" /> <bpmn:participant id="Participant_19w87ws" name="Workflow Message Service (communication with DMAAP) " /> - <bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="Participant_0atuyq0" /> + <bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0atuyq0" /> <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" /> <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" /> <bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" /> @@ -14,12 +14,12 @@ <bpmn:process id="CreateAndActivatePnfResource" name="CreateAndActivatePnfResource" isExecutable="true"> <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="CancelDmaapClientSubscription" /> <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="InformDmaapClient" targetRef="WaitForDmaapPnfReadyNotification" /> - <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreateAndActivatePnf_CreateAaiEntry"> + <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreatePnfEntryInAai"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" /> <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" /> - <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="AaiEntryExists" /> + <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" /> <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" /> <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" /> @@ -35,16 +35,11 @@ <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${InformDmaapClient}"> + <bpmn:serviceTask id="InformDmaapClient" name="Register in Dmaap" camunda:delegateExpression="${InformDmaapClient}"> <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists"> - <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> - </bpmn:intermediateThrowEvent> - <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${CreateAaiEntryWithPnfIdDelegate}"> + <bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:delegateExpression="${CreatePnfEntryInAaiDelegate}"> <bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing> </bpmn:serviceTask> @@ -77,11 +72,17 @@ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:boundaryEvent> + <bpmn:exclusiveGateway id="AaiEntryExists" name="AAI entry exists"> + <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> + </bpmn:exclusiveGateway> <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" /> <bpmn:textAnnotation id="TextAnnotation_1eyzes8"> <bpmn:text>Inputs: Â -Â timeoutForPnfEntryNotification - String - correlationId - String + - uuid - String </bpmn:text> </bpmn:textAnnotation> </bpmn:process> @@ -113,7 +114,7 @@ <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId"> <dc:Bounds x="219" y="167" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreateAndActivatePnf_CreateAaiEntry"> + <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreatePnfEntryInAai"> <dc:Bounds x="511" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt"> @@ -124,12 +125,12 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak"> - <di:waypoint x="415" y="207" /> + <di:waypoint x="415" y="182" /> <di:waypoint x="415" y="66" /> - <di:waypoint x="707" y="66" /> - <di:waypoint x="707" y="189" /> + <di:waypoint x="711" y="66" /> + <di:waypoint x="711" y="182" /> <bpmndi:BPMNLabel> - <dc:Bounds x="430" y="180" width="19" height="14" /> + <dc:Bounds x="430" y="159" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe"> @@ -141,7 +142,7 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf"> <di:waypoint x="611" y="207" /> - <di:waypoint x="689" y="207" /> + <di:waypoint x="686" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="605" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -186,18 +187,12 @@ <dc:Bounds x="1305" y="382" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists"> - <dc:Bounds x="689" y="189" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="672" y="235" width="77" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8"> - <dc:Bounds x="-37" y="70" width="243" height="54" /> + <dc:Bounds x="-37" y="70" width="243" height="82" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz"> <di:waypoint x="-36" y="189" /> - <di:waypoint x="-36" y="124" /> + <di:waypoint x="-36" y="152" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d"> <di:waypoint x="1060" y="523" /> @@ -207,7 +202,7 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025"> - <di:waypoint x="725" y="207" /> + <di:waypoint x="736" y="207" /> <di:waypoint x="803" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="187" width="90" height="10" /> @@ -281,6 +276,12 @@ <bpmndi:BPMNShape id="ServiceTask_0lx02qn_di" bpmnElement="CheckInputs"> <dc:Bounds x="48" y="167" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0qwrtuy_di" bpmnElement="AaiEntryExists" isMarkerVisible="true"> + <dc:Bounds x="686" y="182" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="672" y="242" width="77" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn index 02b564e81f..3940dece12 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn @@ -1,12 +1,12 @@ <?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.11.3" 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="2.0.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateVcpeResCustService_simplified" name="CreateVcpeResCustService_simplified" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.sendSyncResponse(execution)]]></bpmn2:script> +CreateVcpeResCustService.sendSyncResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="sendSyncAckResponse_ScriptTask" targetRef="IntermediateThrowEvent_2" /> <bpmn2:startEvent id="createVCPE_startEvent" name="Start Flow"> @@ -16,10 +16,9 @@ CreateVcpeResCustService.sendSyncResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.preProcessRequest(execution) -]]></bpmn2:script> +CreateVcpeResCustService.preProcessRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="sendSyncAckResponse_ScriptTask" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_3" name="vCPE-RESCUST"> @@ -29,9 +28,9 @@ CreateVcpeResCustService.preProcessRequest(execution) <bpmn2:scriptTask id="postProcessAndCompletionRequest_ScriptTask" name="Post Process & Completion Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0afe2pg</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessResponse(execution)]]></bpmn2:script> +CreateVcpeResCustService.postProcessResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="postProcessAndCompletionRequest_ScriptTask" targetRef="callCompleteMsoProcess_CallActivity" /> <bpmn2:callActivity id="callCompleteMsoProcess_CallActivity" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> @@ -52,8 +51,8 @@ CreateVcpeResCustService.postProcessResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_2" name="Set Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[// The following variable is checked by the unit test -execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true)]]></bpmn2:script> + <bpmn2:script>// The following variable is checked by the unit test +execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ScriptTask_2" targetRef="CreateVCPE_EndEvent" /> <bpmn2:endEvent id="CreateVCPE_EndEvent" name="End"> @@ -72,9 +71,9 @@ execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true)]]></bpmn <bpmn2:scriptTask id="ScriptTask_1" name="Log / Print Unexpected Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn2:script> +ex.processJavaException(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_1" /> </bpmn2:subProcess> @@ -124,16 +123,16 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0yk02h3" name="Prepare FalloutHandler" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0jg47xm</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0807ukc</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script> +CreateVcpeResCustService.prepareFalloutRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0zpbskl" name="Yes" sourceRef="ExclusiveGateway_1vwgs6p" targetRef="ExclusiveGateway_0ydrtdx"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("disableRollback") != true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("disableRollback") != true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0dhf2js" name="No" sourceRef="ExclusiveGateway_1vwgs6p" targetRef="InclusiveGateway_0foywso" /> <bpmn2:sequenceFlow id="SequenceFlow_1sx5llu" name="Yes" sourceRef="ExclusiveGateway_0ydrtdx" targetRef="InclusiveGateway_0foywso"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PONR") == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("PONR") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_02o4yqx" name="No" sourceRef="ExclusiveGateway_0ydrtdx" targetRef="ScriptTask_17doerz" /> <bpmn2:sequenceFlow id="SequenceFlow_19mxskt" name="No" sourceRef="ExclusiveGateway_1kvn1pz" targetRef="ExclusiveGateway_05indeh" /> @@ -176,16 +175,16 @@ CreateVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_17doerz" name="Pre Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_02o4yqx</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ftzjjm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() -CreateVcpeResCustService.preProcessRollback(execution)]]></bpmn2:script> +CreateVcpeResCustService.preProcessRollback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0wyub4x" name="Post Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0dvsqpp</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1rabks0</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> +CreateVcpeResCustService.postProcessRollback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1rabks0" sourceRef="ScriptTask_0wyub4x" targetRef="InclusiveGateway_0foywso" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_06gq6em" name="is AR_BRG Ok?" default="SequenceFlow_0ya1cr3"> @@ -210,7 +209,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_027lz43</bpmn2:outgoing> </bpmn2:inclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0orpdrl" name="Yes" sourceRef="ExclusiveGateway_06gq6em" targetRef="CallActivity_1bpuf2p"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DCARBRG_rollbackData") != null }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("DCARBRG_rollbackData") != null }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1t3cnnx" sourceRef="CallActivity_1bpuf2p" targetRef="ExclusiveGateway_1mjdcct" /> <bpmn2:sequenceFlow id="SequenceFlow_0ya1cr3" name="No" sourceRef="ExclusiveGateway_06gq6em" targetRef="InclusiveGateway_131ozdf" /> @@ -231,7 +230,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0dr2fem</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_1sim44y" name="Yes" sourceRef="ExclusiveGateway_1mjdcct" targetRef="InclusiveGateway_131ozdf"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARBRG_rolledBack") == true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{ execution.getVariable("DCARBRG_rolledBack") == true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0dr2fem" name="No" sourceRef="ExclusiveGateway_1mjdcct" targetRef="InclusiveGateway_1xenadu" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_05dg1m1" name="Rollback success?" default="SequenceFlow_1mbymcu"> @@ -240,7 +239,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1mbymcu</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_1quvahv" name="Yes" sourceRef="ExclusiveGateway_05dg1m1" targetRef="InclusiveGateway_142br6v"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCVAM_rolledBack") ==true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{ execution.getVariable("DCVAM_rolledBack") ==true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1mbymcu" name="No" sourceRef="ExclusiveGateway_05dg1m1" targetRef="InclusiveGateway_0m9f5ka" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_0y7gtd9" name="rollback failed?" default="SequenceFlow_12dakwh"> @@ -259,7 +258,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1lv5ld6" sourceRef="InclusiveGateway_0m9f5ka" targetRef="InclusiveGateway_1xenadu" /> <bpmn2:sequenceFlow id="SequenceFlow_0dvsqpp" sourceRef="InclusiveGateway_1xenadu" targetRef="ScriptTask_0wyub4x" /> <bpmn2:sequenceFlow id="SequenceFlow_09nn9a9" name="Yes" sourceRef="ExclusiveGateway_0y7gtd9" targetRef="InclusiveGateway_1xenadu"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("rolledBack") != null && execution.getVariable("rolledBack") == false}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("rolledBack") != null && execution.getVariable("rolledBack") == false}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_027lz43" sourceRef="InclusiveGateway_131ozdf" targetRef="ExclusiveGateway_14tl857" /> <bpmn2:sequenceFlow id="SequenceFlow_0t3mtod" sourceRef="InclusiveGateway_142br6v" targetRef="ExclusiveGateway_1kvn1pz" /> @@ -275,7 +274,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0ne9n0g</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1sl79hn" name="Yes" sourceRef="ExclusiveGateway_1kvn1pz" targetRef="CallActivity_071yaf8"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DCARTXC_rollbackData") != null }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("DCARTXC_rollbackData") != null }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:exclusiveGateway id="ExclusiveGateway_0y158bb" name="Rollback success?" default="SequenceFlow_00by7l7"> <bpmn2:incoming>SequenceFlow_0ne9n0g</bpmn2:incoming> @@ -284,11 +283,11 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0ne9n0g" sourceRef="CallActivity_071yaf8" targetRef="ExclusiveGateway_0y158bb" /> <bpmn2:sequenceFlow id="SequenceFlow_1a7e8l1" name="Yes" sourceRef="ExclusiveGateway_05indeh" targetRef="DoRollbackService_CallActivity"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCRESI_rollbackData") != null }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{ execution.getVariable("DCRESI_rollbackData") != null }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_00by7l7" name="No" sourceRef="ExclusiveGateway_0y158bb" targetRef="InclusiveGateway_0m9f5ka" /> <bpmn2:sequenceFlow id="SequenceFlow_17cz98f" name="Yes" sourceRef="ExclusiveGateway_0y158bb" targetRef="ExclusiveGateway_05indeh"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARTXC_rolledBack") == true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{ execution.getVariable("DCARTXC_rolledBack") == true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:callActivity id="CallActivity_1cl4iu4" name="DoRollback VNF and Modules " calledElement="DoCreateVnfAndModulesRollback"> <bpmn2:extensionElements> @@ -303,13 +302,13 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1mpsdaj" sourceRef="CallActivity_1cl4iu4" targetRef="ExclusiveGateway_05dg1m1" /> <bpmn2:sequenceFlow id="SequenceFlow_007p8k3" name="Yes" sourceRef="ExclusiveGateway_14tl857" targetRef="CallActivity_1cl4iu4"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DCVAM_rollbackData") != null }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("DCVAM_rollbackData") != null }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> </bpmn2:subProcess> <bpmn2:scriptTask id="setPONR_ScriptTask" name="set PONR"> <bpmn2:incoming>SequenceFlow_12ilko1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0afe2pg</bpmn2:outgoing> - <bpmn2:script><![CDATA[#{execution.setVariable("PONR", true)}]]></bpmn2:script> + <bpmn2:script>#{execution.setVariable("PONR", true)}</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_12ilko1" sourceRef="IntermediateCatchEvent_4" targetRef="setPONR_ScriptTask" /> <bpmn2:sequenceFlow id="SequenceFlow_0afe2pg" sourceRef="setPONR_ScriptTask" targetRef="postProcessAndCompletionRequest_ScriptTask" /> @@ -332,9 +331,9 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0cdtchu" name="Prepare Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1eu60rt</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_00h6hmd</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareDecomposeService(execution)]]></bpmn2:script> +CreateVcpeResCustService.prepareDecomposeService(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1eu60rt" sourceRef="IntermediateCatchEvent_3" targetRef="ScriptTask_0cdtchu" /> <bpmn2:sequenceFlow id="SequenceFlow_00h6hmd" sourceRef="ScriptTask_0cdtchu" targetRef="DecomposeService" /> @@ -350,20 +349,21 @@ CreateVcpeResCustService.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0lpv2da" name="PostProcess Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17g05fd</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11efpvh</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.processDecomposition(execution)]]></bpmn2:script> +CreateVcpeResCustService.processDecomposition(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_11efpvh" sourceRef="ScriptTask_0lpv2da" targetRef="IntermediateThrowEvent_0prlju0" /> - <bpmn2:sequenceFlow id="SequenceFlow_0gj4vud" sourceRef="IntermediateCatchEvent_17pzn7m" targetRef="Task_14l19kv" /> + <bpmn2:sequenceFlow id="SequenceFlow_0gj4vud" sourceRef="IntermediateCatchEvent_17pzn7m" targetRef="GeneratePnfUuid" /> <bpmn2:sequenceFlow id="SequenceFlow_0clhseq" sourceRef="Task_14l19kv" targetRef="IntermediateThrowEvent_0lt5ltv" /> <bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource"> <bpmn2:extensionElements> <camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" /> <camunda:in source="correlationId" target="correlationId" /> <camunda:in businessKey="#{execution.processBusinessKey}" /> + <camunda:in source="pnfUuid" target="pnfUuid" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1yojilk</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0clhseq</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:callActivity id="CallActivity_1vc4jeh" name="Call Create ServiceInstance " calledElement="DoCreateServiceInstance"> @@ -393,16 +393,16 @@ CreateVcpeResCustService.processDecomposition(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1y241p8" name="Prepare Create Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1429lyc</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0bt420h</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareCreateServiceInstance(execution)]]></bpmn2:script> +CreateVcpeResCustService.prepareCreateServiceInstance(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_1y5lvl7" name="Post Process Create Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0ocy2qp</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11gw54u</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* + <bpmn2:script>import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:script> +CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0m5yuay" name="StartService"> <bpmn2:outgoing>SequenceFlow_1429lyc</bpmn2:outgoing> @@ -416,6 +416,11 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <bpmn2:sequenceFlow id="SequenceFlow_0ocy2qp" sourceRef="CallActivity_1vc4jeh" targetRef="ScriptTask_1y5lvl7" /> <bpmn2:sequenceFlow id="SequenceFlow_1429lyc" sourceRef="IntermediateCatchEvent_0m5yuay" targetRef="ScriptTask_1y241p8" /> <bpmn2:sequenceFlow id="SequenceFlow_11gw54u" sourceRef="ScriptTask_1y5lvl7" targetRef="IntermediateThrowEvent_13xv36r" /> + <bpmn2:sequenceFlow id="SequenceFlow_1yojilk" sourceRef="GeneratePnfUuid" targetRef="Task_14l19kv" /> + <bpmn2:serviceTask id="GeneratePnfUuid" name="Generate Pnf UUID" camunda:delegateExpression="${GeneratePnfUuidDelegate}"> + <bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1yojilk</bpmn2:outgoing> + </bpmn2:serviceTask> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -431,8 +436,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="256" y="789" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61"> - <di:waypoint xsi:type="dc:Point" x="103" y="829" /> - <di:waypoint xsi:type="dc:Point" x="256" y="829" /> + <di:waypoint x="103" y="829" /> + <di:waypoint x="256" y="829" /> <bpmndi:BPMNLabel> <dc:Bounds x="100" y="829" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -444,8 +449,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="490" y="1432" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_61" targetElement="_BPMNShape_ScriptTask_127"> - <di:waypoint xsi:type="dc:Point" x="356" y="829" /> - <di:waypoint xsi:type="dc:Point" x="447" y="829" /> + <di:waypoint x="356" y="829" /> + <di:waypoint x="447" y="829" /> <bpmndi:BPMNLabel> <dc:Bounds x="200" y="790" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -454,8 +459,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="447" y="789" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_42" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_80" targetElement="_BPMNShape_CallActivity_4"> - <di:waypoint xsi:type="dc:Point" x="590" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="763" y="1472" /> + <di:waypoint x="590" y="1472" /> + <di:waypoint x="763" y="1472" /> <bpmndi:BPMNLabel> <dc:Bounds x="632" y="1457" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -467,8 +472,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_CallActivity_4" targetElement="_BPMNShape_ScriptTask_337"> - <di:waypoint xsi:type="dc:Point" x="863" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="1071" y="1471" /> + <di:waypoint x="863" y="1472" /> + <di:waypoint x="1071" y="1471" /> <bpmndi:BPMNLabel> <dc:Bounds x="922" y="1457" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -492,24 +497,24 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_269"> - <di:waypoint xsi:type="dc:Point" x="1361" y="1825" /> - <di:waypoint xsi:type="dc:Point" x="1400" y="1825" /> + <di:waypoint x="1361" y="1825" /> + <di:waypoint x="1400" y="1825" /> <bpmndi:BPMNLabel> <dc:Bounds x="1344" y="1825" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_269" targetElement="_BPMNShape_EndEvent_219"> - <di:waypoint xsi:type="dc:Point" x="1500" y="1825" /> - <di:waypoint xsi:type="dc:Point" x="1533" y="1825" /> - <di:waypoint xsi:type="dc:Point" x="1533" y="1825" /> - <di:waypoint xsi:type="dc:Point" x="1553" y="1825" /> + <di:waypoint x="1500" y="1825" /> + <di:waypoint x="1533" y="1825" /> + <di:waypoint x="1533" y="1825" /> + <di:waypoint x="1553" y="1825" /> <bpmndi:BPMNLabel> <dc:Bounds x="1503" y="1825" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_127"> - <di:waypoint xsi:type="dc:Point" x="547" y="829" /> - <di:waypoint xsi:type="dc:Point" x="699" y="829" /> + <di:waypoint x="547" y="829" /> + <di:waypoint x="699" y="829" /> <bpmndi:BPMNLabel> <dc:Bounds x="578" y="814" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -518,8 +523,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="1071" y="1431" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_337" targetElement="_BPMNShape_EndEvent_177"> - <di:waypoint xsi:type="dc:Point" x="1171" y="1470" /> - <di:waypoint xsi:type="dc:Point" x="1262" y="1470" /> + <di:waypoint x="1171" y="1470" /> + <di:waypoint x="1262" y="1470" /> <bpmndi:BPMNLabel> <dc:Bounds x="1172" y="1455" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -582,41 +587,41 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="891" y="2945" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zpbskl_di" bpmnElement="SequenceFlow_0zpbskl"> - <di:waypoint xsi:type="dc:Point" x="75" y="2971" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2938" /> + <di:waypoint x="75" y="2971" /> + <di:waypoint x="75" y="2938" /> <bpmndi:BPMNLabel> <dc:Bounds x="81" y="2958" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0dhf2js_di" bpmnElement="SequenceFlow_0dhf2js"> - <di:waypoint xsi:type="dc:Point" x="100" y="2996" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2996" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2938" /> + <di:waypoint x="100" y="2996" /> + <di:waypoint x="734" y="2996" /> + <di:waypoint x="734" y="2938" /> <bpmndi:BPMNLabel> <dc:Bounds x="140" y="3001" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1sx5llu_di" bpmnElement="SequenceFlow_1sx5llu"> - <di:waypoint xsi:type="dc:Point" x="100" y="2913" /> - <di:waypoint xsi:type="dc:Point" x="405" y="2913" /> - <di:waypoint xsi:type="dc:Point" x="405" y="2913" /> - <di:waypoint xsi:type="dc:Point" x="709" y="2913" /> + <di:waypoint x="100" y="2913" /> + <di:waypoint x="405" y="2913" /> + <di:waypoint x="405" y="2913" /> + <di:waypoint x="709" y="2913" /> <bpmndi:BPMNLabel> <dc:Bounds x="419" y="2917" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_02o4yqx_di" bpmnElement="SequenceFlow_02o4yqx"> - <di:waypoint xsi:type="dc:Point" x="75" y="2888" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2866" /> + <di:waypoint x="75" y="2888" /> + <di:waypoint x="75" y="2866" /> <bpmndi:BPMNLabel> <dc:Bounds x="86" y="2871" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19mxskt_di" bpmnElement="SequenceFlow_19mxskt"> - <di:waypoint xsi:type="dc:Point" x="202" y="1821" /> - <di:waypoint xsi:type="dc:Point" x="202" y="1725" /> - <di:waypoint xsi:type="dc:Point" x="681" y="1725" /> - <di:waypoint xsi:type="dc:Point" x="681" y="1941" /> + <di:waypoint x="202" y="1821" /> + <di:waypoint x="202" y="1725" /> + <di:waypoint x="681" y="1725" /> + <di:waypoint x="681" y="1941" /> <bpmndi:BPMNLabel> <dc:Bounds x="392" y="1704" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -625,16 +630,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="204" y="1432" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_12ilko1_di" bpmnElement="SequenceFlow_12ilko1"> - <di:waypoint xsi:type="dc:Point" x="96" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="204" y="1472" /> + <di:waypoint x="96" y="1472" /> + <di:waypoint x="204" y="1472" /> <bpmndi:BPMNLabel> <dc:Bounds x="105" y="1447" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0afe2pg_di" bpmnElement="SequenceFlow_0afe2pg"> - <di:waypoint xsi:type="dc:Point" x="304" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="447" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="490" y="1472" /> + <di:waypoint x="304" y="1472" /> + <di:waypoint x="447" y="1472" /> + <di:waypoint x="490" y="1472" /> <bpmndi:BPMNLabel> <dc:Bounds x="331" y="1457" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -649,30 +654,30 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1f1hd3l_di" bpmnElement="SequenceFlow_1f1hd3l"> - <di:waypoint xsi:type="dc:Point" x="1026" y="2006" /> - <di:waypoint xsi:type="dc:Point" x="1026" y="2103" /> + <di:waypoint x="1026" y="2006" /> + <di:waypoint x="1026" y="2103" /> <bpmndi:BPMNLabel> <dc:Bounds x="996" y="2055" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0jg47xm_di" bpmnElement="SequenceFlow_0jg47xm"> - <di:waypoint xsi:type="dc:Point" x="759" y="2913" /> - <di:waypoint xsi:type="dc:Point" x="941" y="2913" /> - <di:waypoint xsi:type="dc:Point" x="941" y="2945" /> + <di:waypoint x="759" y="2913" /> + <di:waypoint x="941" y="2913" /> + <di:waypoint x="941" y="2945" /> <bpmndi:BPMNLabel> <dc:Bounds x="805" y="2898" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0807ukc_di" bpmnElement="SequenceFlow_0807ukc"> - <di:waypoint xsi:type="dc:Point" x="991" y="2985" /> - <di:waypoint xsi:type="dc:Point" x="1023" y="2985" /> + <di:waypoint x="991" y="2985" /> + <di:waypoint x="1023" y="2985" /> <bpmndi:BPMNLabel> <dc:Bounds x="962" y="2970" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19yywk8_di" bpmnElement="SequenceFlow_19yywk8"> - <di:waypoint xsi:type="dc:Point" x="1123" y="2985" /> - <di:waypoint xsi:type="dc:Point" x="1160" y="2985" /> + <di:waypoint x="1123" y="2985" /> + <di:waypoint x="1160" y="2985" /> <bpmndi:BPMNLabel> <dc:Bounds x="1097" y="2970" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -690,9 +695,9 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sezboq_di" bpmnElement="SequenceFlow_0sezboq"> - <di:waypoint xsi:type="dc:Point" x="681" y="1991" /> - <di:waypoint xsi:type="dc:Point" x="681" y="2128" /> - <di:waypoint xsi:type="dc:Point" x="1001" y="2128" /> + <di:waypoint x="681" y="1991" /> + <di:waypoint x="681" y="2128" /> + <di:waypoint x="1001" y="2128" /> <bpmndi:BPMNLabel> <dc:Bounds x="689" y="2045" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -701,10 +706,10 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="25" y="2786" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zq7i3q_di" bpmnElement="SequenceFlow_0zq7i3q"> - <di:waypoint xsi:type="dc:Point" x="-27" y="2997" /> - <di:waypoint xsi:type="dc:Point" x="20" y="2997" /> - <di:waypoint xsi:type="dc:Point" x="20" y="2996" /> - <di:waypoint xsi:type="dc:Point" x="50" y="2996" /> + <di:waypoint x="-27" y="2997" /> + <di:waypoint x="20" y="2997" /> + <di:waypoint x="20" y="2996" /> + <di:waypoint x="50" y="2996" /> <bpmndi:BPMNLabel> <dc:Bounds x="-56" y="2998" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -719,8 +724,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="684" y="2786" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1rabks0_di" bpmnElement="SequenceFlow_1rabks0"> - <di:waypoint xsi:type="dc:Point" x="734" y="2866" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2888" /> + <di:waypoint x="734" y="2866" /> + <di:waypoint x="734" y="2888" /> <bpmndi:BPMNLabel> <dc:Bounds x="704" y="2877" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -732,15 +737,15 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="256" y="944" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1eu60rt_di" bpmnElement="SequenceFlow_1eu60rt"> - <di:waypoint xsi:type="dc:Point" x="103" y="984" /> - <di:waypoint xsi:type="dc:Point" x="256" y="984" /> + <di:waypoint x="103" y="984" /> + <di:waypoint x="256" y="984" /> <bpmndi:BPMNLabel> <dc:Bounds x="135" y="969" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_00h6hmd_di" bpmnElement="SequenceFlow_00h6hmd"> - <di:waypoint xsi:type="dc:Point" x="356" y="984" /> - <di:waypoint xsi:type="dc:Point" x="447" y="984" /> + <di:waypoint x="356" y="984" /> + <di:waypoint x="447" y="984" /> <bpmndi:BPMNLabel> <dc:Bounds x="357" y="969" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -761,25 +766,25 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0orpdrl_di" bpmnElement="SequenceFlow_0orpdrl"> - <di:waypoint xsi:type="dc:Point" x="100" y="2628" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2628" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2598" /> + <di:waypoint x="100" y="2628" /> + <di:waypoint x="202" y="2628" /> + <di:waypoint x="202" y="2598" /> <bpmndi:BPMNLabel> <dc:Bounds x="141" y="2613" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1t3cnnx_di" bpmnElement="SequenceFlow_1t3cnnx"> - <di:waypoint xsi:type="dc:Point" x="202" y="2518" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2481" /> + <di:waypoint x="202" y="2518" /> + <di:waypoint x="202" y="2481" /> <bpmndi:BPMNLabel> <dc:Bounds x="172" y="2500" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ya1cr3_di" bpmnElement="SequenceFlow_0ya1cr3"> - <di:waypoint xsi:type="dc:Point" x="75" y="2603" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2542" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2542" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2481" /> + <di:waypoint x="75" y="2603" /> + <di:waypoint x="75" y="2542" /> + <di:waypoint x="75" y="2542" /> + <di:waypoint x="75" y="2481" /> <bpmndi:BPMNLabel> <dc:Bounds x="88" y="2508" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -797,8 +802,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kpdu1j_di" bpmnElement="SequenceFlow_1kpdu1j"> - <di:waypoint xsi:type="dc:Point" x="75" y="2282" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2153" /> + <di:waypoint x="75" y="2282" /> + <di:waypoint x="75" y="2153" /> <bpmndi:BPMNLabel> <dc:Bounds x="83" y="2218" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -810,16 +815,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1sim44y_di" bpmnElement="SequenceFlow_1sim44y"> - <di:waypoint xsi:type="dc:Point" x="177" y="2456" /> - <di:waypoint xsi:type="dc:Point" x="100" y="2456" /> + <di:waypoint x="177" y="2456" /> + <di:waypoint x="100" y="2456" /> <bpmndi:BPMNLabel> <dc:Bounds x="107" y="2431" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0dr2fem_di" bpmnElement="SequenceFlow_0dr2fem"> - <di:waypoint xsi:type="dc:Point" x="226" y="2457" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2457" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2695" /> + <di:waypoint x="226" y="2457" /> + <di:waypoint x="734" y="2457" /> + <di:waypoint x="734" y="2695" /> <bpmndi:BPMNLabel> <dc:Bounds x="316" y="2436" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -831,22 +836,22 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1quvahv_di" bpmnElement="SequenceFlow_1quvahv"> - <di:waypoint xsi:type="dc:Point" x="177" y="2128" /> - <di:waypoint xsi:type="dc:Point" x="100" y="2128" /> + <di:waypoint x="177" y="2128" /> + <di:waypoint x="100" y="2128" /> <bpmndi:BPMNLabel> <dc:Bounds x="129" y="2103" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mbymcu_di" bpmnElement="SequenceFlow_1mbymcu"> - <di:waypoint xsi:type="dc:Point" x="227" y="2128" /> - <di:waypoint xsi:type="dc:Point" x="1001" y="2128" /> + <di:waypoint x="227" y="2128" /> + <di:waypoint x="1001" y="2128" /> <bpmndi:BPMNLabel> <dc:Bounds x="290" y="2097" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17g05fd_di" bpmnElement="SequenceFlow_17g05fd"> - <di:waypoint xsi:type="dc:Point" x="547" y="984" /> - <di:waypoint xsi:type="dc:Point" x="638" y="984" /> + <di:waypoint x="547" y="984" /> + <di:waypoint x="638" y="984" /> <bpmndi:BPMNLabel> <dc:Bounds x="548" y="969" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -858,15 +863,15 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ftzjjm_di" bpmnElement="SequenceFlow_0ftzjjm"> - <di:waypoint xsi:type="dc:Point" x="75" y="2786" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2745" /> + <di:waypoint x="75" y="2786" /> + <di:waypoint x="75" y="2745" /> <bpmndi:BPMNLabel> <dc:Bounds x="45" y="2766" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12dakwh_di" bpmnElement="SequenceFlow_12dakwh"> - <di:waypoint xsi:type="dc:Point" x="75" y="2695" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2653" /> + <di:waypoint x="75" y="2695" /> + <di:waypoint x="75" y="2653" /> <bpmndi:BPMNLabel> <dc:Bounds x="83" y="2666" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -878,40 +883,40 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lv5ld6_di" bpmnElement="SequenceFlow_1lv5ld6"> - <di:waypoint xsi:type="dc:Point" x="1026" y="2153" /> - <di:waypoint xsi:type="dc:Point" x="1026" y="2720" /> - <di:waypoint xsi:type="dc:Point" x="759" y="2720" /> + <di:waypoint x="1026" y="2153" /> + <di:waypoint x="1026" y="2720" /> + <di:waypoint x="759" y="2720" /> <bpmndi:BPMNLabel> <dc:Bounds x="996" y="2437" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0dvsqpp_di" bpmnElement="SequenceFlow_0dvsqpp"> - <di:waypoint xsi:type="dc:Point" x="734" y="2745" /> - <di:waypoint xsi:type="dc:Point" x="734" y="2786" /> + <di:waypoint x="734" y="2745" /> + <di:waypoint x="734" y="2786" /> <bpmndi:BPMNLabel> <dc:Bounds x="704" y="2766" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09nn9a9_di" bpmnElement="SequenceFlow_09nn9a9"> - <di:waypoint xsi:type="dc:Point" x="100" y="2720" /> - <di:waypoint xsi:type="dc:Point" x="423" y="2720" /> - <di:waypoint xsi:type="dc:Point" x="423" y="2720" /> - <di:waypoint xsi:type="dc:Point" x="709" y="2720" /> + <di:waypoint x="100" y="2720" /> + <di:waypoint x="423" y="2720" /> + <di:waypoint x="423" y="2720" /> + <di:waypoint x="709" y="2720" /> <bpmndi:BPMNLabel> <dc:Bounds x="144" y="2693" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_027lz43_di" bpmnElement="SequenceFlow_027lz43"> - <di:waypoint xsi:type="dc:Point" x="75" y="2431" /> - <di:waypoint xsi:type="dc:Point" x="75" y="2332" /> + <di:waypoint x="75" y="2431" /> + <di:waypoint x="75" y="2332" /> <bpmndi:BPMNLabel> <dc:Bounds x="45" y="2372" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0t3mtod_di" bpmnElement="SequenceFlow_0t3mtod"> - <di:waypoint xsi:type="dc:Point" x="75" y="2103" /> - <di:waypoint xsi:type="dc:Point" x="75" y="1846" /> - <di:waypoint xsi:type="dc:Point" x="177" y="1846" /> + <di:waypoint x="75" y="2103" /> + <di:waypoint x="75" y="1846" /> + <di:waypoint x="177" y="1846" /> <bpmndi:BPMNLabel> <dc:Bounds x="45" y="1965" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -923,19 +928,19 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0lt5ltv_di" bpmnElement="IntermediateThrowEvent_0lt5ltv"> - <dc:Bounds x="466" y="1259" width="36" height="36" /> + <dc:Bounds x="725" y="1259" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="441" y="1306" width="85" height="24" /> + <dc:Bounds x="700" y="1306" width="85" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_071yaf8_di" bpmnElement="CallActivity_071yaf8"> <dc:Bounds x="321" y="1806" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1sl79hn_di" bpmnElement="SequenceFlow_1sl79hn"> - <di:waypoint xsi:type="dc:Point" x="227" y="1846" /> - <di:waypoint xsi:type="dc:Point" x="256" y="1846" /> - <di:waypoint xsi:type="dc:Point" x="256" y="1846" /> - <di:waypoint xsi:type="dc:Point" x="321" y="1846" /> + <di:waypoint x="227" y="1846" /> + <di:waypoint x="256" y="1846" /> + <di:waypoint x="256" y="1846" /> + <di:waypoint x="321" y="1846" /> <bpmndi:BPMNLabel> <dc:Bounds x="271" y="1826" width="19" height="12" /> </bpmndi:BPMNLabel> @@ -947,30 +952,30 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ne9n0g_di" bpmnElement="SequenceFlow_0ne9n0g"> - <di:waypoint xsi:type="dc:Point" x="421" y="1846" /> - <di:waypoint xsi:type="dc:Point" x="521" y="1846" /> + <di:waypoint x="421" y="1846" /> + <di:waypoint x="521" y="1846" /> <bpmndi:BPMNLabel> <dc:Bounds x="426" y="1825" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1a7e8l1_di" bpmnElement="SequenceFlow_1a7e8l1"> - <di:waypoint xsi:type="dc:Point" x="706" y="1966" /> - <di:waypoint xsi:type="dc:Point" x="976" y="1966" /> + <di:waypoint x="706" y="1966" /> + <di:waypoint x="976" y="1966" /> <bpmndi:BPMNLabel> <dc:Bounds x="832" y="1945" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_00by7l7_di" bpmnElement="SequenceFlow_00by7l7"> - <di:waypoint xsi:type="dc:Point" x="546" y="1871" /> - <di:waypoint xsi:type="dc:Point" x="546" y="2128" /> - <di:waypoint xsi:type="dc:Point" x="1001" y="2128" /> + <di:waypoint x="546" y="1871" /> + <di:waypoint x="546" y="2128" /> + <di:waypoint x="1001" y="2128" /> <bpmndi:BPMNLabel> <dc:Bounds x="554" y="1994" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17cz98f_di" bpmnElement="SequenceFlow_17cz98f"> - <di:waypoint xsi:type="dc:Point" x="559" y="1858" /> - <di:waypoint xsi:type="dc:Point" x="668" y="1954" /> + <di:waypoint x="559" y="1858" /> + <di:waypoint x="668" y="1954" /> <bpmndi:BPMNLabel> <dc:Bounds x="615" y="1889" width="19" height="12" /> </bpmndi:BPMNLabel> @@ -979,16 +984,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="152" y="2193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mpsdaj_di" bpmnElement="SequenceFlow_1mpsdaj"> - <di:waypoint xsi:type="dc:Point" x="202" y="2193" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2153" /> + <di:waypoint x="202" y="2193" /> + <di:waypoint x="202" y="2153" /> <bpmndi:BPMNLabel> <dc:Bounds x="172" y="2167" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_007p8k3_di" bpmnElement="SequenceFlow_007p8k3"> - <di:waypoint xsi:type="dc:Point" x="100" y="2307" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2307" /> - <di:waypoint xsi:type="dc:Point" x="202" y="2273" /> + <di:waypoint x="100" y="2307" /> + <di:waypoint x="202" y="2307" /> + <di:waypoint x="202" y="2273" /> <bpmndi:BPMNLabel> <dc:Bounds x="142" y="2286" width="19" height="12" /> </bpmndi:BPMNLabel> @@ -997,28 +1002,28 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s <dc:Bounds x="638" y="944" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11efpvh_di" bpmnElement="SequenceFlow_11efpvh"> - <di:waypoint xsi:type="dc:Point" x="738" y="984" /> - <di:waypoint xsi:type="dc:Point" x="902" y="984" /> + <di:waypoint x="738" y="984" /> + <di:waypoint x="902" y="984" /> <bpmndi:BPMNLabel> <dc:Bounds x="775" y="963" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0gj4vud_di" bpmnElement="SequenceFlow_0gj4vud"> - <di:waypoint xsi:type="dc:Point" x="103" y="1277" /> - <di:waypoint xsi:type="dc:Point" x="256" y="1277" /> + <di:waypoint x="103" y="1277" /> + <di:waypoint x="256" y="1277" /> <bpmndi:BPMNLabel> <dc:Bounds x="134.5" y="1257" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0clhseq_di" bpmnElement="SequenceFlow_0clhseq"> - <di:waypoint xsi:type="dc:Point" x="356" y="1277" /> - <di:waypoint xsi:type="dc:Point" x="466" y="1277" /> + <di:waypoint x="547" y="1277" /> + <di:waypoint x="725" y="1277" /> <bpmndi:BPMNLabel> <dc:Bounds x="366" y="1257" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1totpg4_di" bpmnElement="Task_14l19kv"> - <dc:Bounds x="256" y="1237" width="100" height="80" /> + <dc:Bounds x="447" y="1237" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1vc4jeh_di" bpmnElement="CallActivity_1vc4jeh"> <dc:Bounds x="447" y="1072" width="100" height="80" /> @@ -1042,33 +1047,40 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]></bpmn2:s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0bt420h_di" bpmnElement="SequenceFlow_0bt420h"> - <di:waypoint xsi:type="dc:Point" x="356" y="1112" /> - <di:waypoint xsi:type="dc:Point" x="447" y="1112" /> + <di:waypoint x="356" y="1112" /> + <di:waypoint x="447" y="1112" /> <bpmndi:BPMNLabel> <dc:Bounds x="356.5" y="1091" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ocy2qp_di" bpmnElement="SequenceFlow_0ocy2qp"> - <di:waypoint xsi:type="dc:Point" x="547" y="1112" /> - <di:waypoint xsi:type="dc:Point" x="638" y="1112" /> + <di:waypoint x="547" y="1112" /> + <di:waypoint x="638" y="1112" /> <bpmndi:BPMNLabel> <dc:Bounds x="547.5" y="1091" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1429lyc_di" bpmnElement="SequenceFlow_1429lyc"> - <di:waypoint xsi:type="dc:Point" x="101" y="1112" /> - <di:waypoint xsi:type="dc:Point" x="256" y="1112" /> + <di:waypoint x="101" y="1112" /> + <di:waypoint x="256" y="1112" /> <bpmndi:BPMNLabel> <dc:Bounds x="133.5" y="1091" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11gw54u_di" bpmnElement="SequenceFlow_11gw54u"> - <di:waypoint xsi:type="dc:Point" x="738" y="1112" /> - <di:waypoint xsi:type="dc:Point" x="902" y="1112" /> + <di:waypoint x="738" y="1112" /> + <di:waypoint x="902" y="1112" /> <bpmndi:BPMNLabel> <dc:Bounds x="775" y="1091" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yojilk_di" bpmnElement="SequenceFlow_1yojilk"> + <di:waypoint x="356" y="1277" /> + <di:waypoint x="447" y="1277" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1j71wic_di" bpmnElement="GeneratePnfUuid"> + <dc:Bounds x="256" y="1237" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn index 2f5fa39dbc..c049eaafa0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn @@ -1,16 +1,12 @@ <?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="2.0.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateNetworkInstance" name="DoCreateNetworkInstance" isExecutable="true"> <bpmn2:startEvent id="createNetwork_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1n61wit</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="aai_Error_EndEvent" name="AAI Name Error"> - <bpmn2:incoming>isReturnCode404_No_SequenceFlow</bpmn2:incoming> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_53" errorRef="Error_2" /> - </bpmn2:endEvent> <bpmn2:inclusiveGateway id="InclusiveGateway"> <bpmn2:incoming>isNetworkActiveNo_SequenceFlow</bpmn2:incoming> - <bpmn2:incoming>isReturnCode404_Yes_SequenceFlow</bpmn2:incoming> + <bpmn2:incoming>isAAIQueryNameNo_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_21</bpmn2:outgoing> </bpmn2:inclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_21" sourceRef="InclusiveGateway" targetRef="callRESTQueryCloudRegion_ScriptTask" /> @@ -18,27 +14,27 @@ <bpmn2:incoming>SequenceFlow_21</bpmn2:incoming> <bpmn2:incoming>isNameSentNo_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAICloudRegion(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAICloudRegion(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="callRESTQueryCloudRegion_ScriptTask" targetRef="isSdncRpc1_ExclusiveGateway1" /> <bpmn2:scriptTask id="prepareSDNCTopoRequest_ScriptTask" name="Prepare Assign SDNC Request" scriptFormat="groovy"> <bpmn2:incoming>isSdncRpc1No_SequenceFlow1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.prepareSDNCRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="prepareSDNCTopoRequest_ScriptTask" targetRef="callAssignSDNCAdapter_CallActivity" /> <bpmn2:scriptTask id="validateSDNCResponse_ScriptTask" name="Validate SDNC Assign Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0d93bqw</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.validateSDNCResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.validateSDNCResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="isSdncTopoOk_ExclusiveGateway" name="Is SDNC Ok?" default="sdncTopoNo_SequenceFlow"> <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> @@ -47,7 +43,7 @@ DoCreateNetworkInstance.validateSDNCResponse(execution)]]></bpmn2:script> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="sdncTopoNo_SequenceFlow" name="No" sourceRef="isSdncTopoOk_ExclusiveGateway" targetRef="sndcError_EndEvent" /> <bpmn2:sequenceFlow id="sdncTopoYes_SequenceFlow" name="Yes" sourceRef="isSdncTopoOk_ExclusiveGateway" targetRef="callRESTQueryNetworkId_ScriptTask"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_sdncResponseSuccess" ) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_sdncResponseSuccess" ) == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="validateSDNCResponse_ScriptTask" targetRef="isSdncTopoOk_ExclusiveGateway" /> <bpmn2:boundaryEvent id="BoundaryEvent_4" name="" attachedToRef="validateSDNCResponse_ScriptTask"> @@ -63,9 +59,9 @@ DoCreateNetworkInstance.validateSDNCResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="callRESTQueryNetworkId_ScriptTask" name="Call REST Query Network Id In AAI" scriptFormat="groovy"> <bpmn2:incoming>sdncTopoYes_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAINetworkId(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAINetworkId(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="callRESTQueryNetworkId_ScriptTask" targetRef="callRESTQueryVpnBinding_ScriptTask" /> <bpmn2:callActivity id="callAssignSDNCAdapter_CallActivity" name="Call SDNC Assign Adapter V1 " calledElement="sdncAdapter"> @@ -85,9 +81,9 @@ DoCreateNetworkInstance.callRESTQueryAAINetworkId(execution)]]></bpmn2:script> <bpmn2:scriptTask id="validateCreatePONetwork_ScriptTask" name="Validate Create PO Network" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_59</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.validateCreateNetworkResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.validateCreateNetworkResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="isNetworkActive_ExclusiveGateway" name="Is Network Active?" default="isNetworkActiveNo_SequenceFlow"> <bpmn2:incoming>isAAIQueryNameYes_SequenceFlow</bpmn2:incoming> @@ -95,7 +91,7 @@ DoCreateNetworkInstance.validateCreateNetworkResponse(execution)]]></bpmn2:scrip <bpmn2:outgoing>isNetworkActiveNo_SequenceFlow</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isNetworkActiveYes_SequenceFlow" name="Yes" sourceRef="isNetworkActive_ExclusiveGateway" targetRef="ScriptTask_0p3v749"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE"}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE"}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isNetworkActiveNo_SequenceFlow" name="No" sourceRef="isNetworkActive_ExclusiveGateway" targetRef="InclusiveGateway" /> <bpmn2:exclusiveGateway id="isAAIQueryNameOk_ExclusiveGateway" name="Is Query Name Ok? " default="isAAIQueryNameNo_SequenceFlow"> @@ -103,20 +99,9 @@ DoCreateNetworkInstance.validateCreateNetworkResponse(execution)]]></bpmn2:scrip <bpmn2:outgoing>isAAIQueryNameNo_SequenceFlow</bpmn2:outgoing> <bpmn2:outgoing>isAAIQueryNameYes_SequenceFlow</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="isAAIQueryNameNo_SequenceFlow" name="No" sourceRef="isAAIQueryNameOk_ExclusiveGateway" targetRef="isReturnCode404_ExclusiveGateway" /> + <bpmn2:sequenceFlow id="isAAIQueryNameNo_SequenceFlow" name="No" sourceRef="isAAIQueryNameOk_ExclusiveGateway" targetRef="InclusiveGateway" /> <bpmn2:sequenceFlow id="isAAIQueryNameYes_SequenceFlow" name="Yes" sourceRef="isAAIQueryNameOk_ExclusiveGateway" targetRef="isNetworkActive_ExclusiveGateway"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_isAAIqueryNameGood") == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="isReturnCode404_ExclusiveGateway" name="Is Code 404?" default="isReturnCode404_No_SequenceFlow"> - <bpmn2:incoming>isAAIQueryNameNo_SequenceFlow</bpmn2:incoming> - <bpmn2:outgoing>isReturnCode404_No_SequenceFlow</bpmn2:outgoing> - <bpmn2:outgoing>isReturnCode404_Yes_SequenceFlow</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="isReturnCode404_No_SequenceFlow" name="No" sourceRef="isReturnCode404_ExclusiveGateway" targetRef="aai_Error_EndEvent" /> - <bpmn2:sequenceFlow id="isReturnCode404_Yes_SequenceFlow" name="Yes" sourceRef="isReturnCode404_ExclusiveGateway" targetRef="InclusiveGateway"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_aaiNameReturnCode" ) == "404"} - -]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_isAAIqueryNameGood") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:subProcess id="subProcessException_SubProcess" name="Subprocess For Prepare Rollback Data" triggeredByEvent="true"> <bpmn2:startEvent id="subProcessStart_StartEvent" name="Fault Start"> @@ -130,7 +115,7 @@ DoCreateNetworkInstance.validateCreateNetworkResponse(execution)]]></bpmn2:scrip <bpmn2:outgoing>isPONR_No_SequenceFlow</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isPONR_Yes_SequenceFlow" name="Yes" sourceRef="isPONR_ExclusiveGateway" targetRef="ExclusiveGateway_1umhuft"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_isPONR") == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_isPONR") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isPONR_No_SequenceFlow" name="No" sourceRef="isPONR_ExclusiveGateway" targetRef="isSDNCActivate_ExclusiveGateway" /> <bpmn2:exclusiveGateway id="sdncOk_ExclusiveGateway" name="is SDNC Topo Ok?" default="sdncOk_No_ExclusiveGateway"> @@ -139,15 +124,15 @@ DoCreateNetworkInstance.validateCreateNetworkResponse(execution)]]></bpmn2:scrip <bpmn2:outgoing>sdncOk_No_ExclusiveGateway</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="sdncOk_Yeso_ExclusiveGateway" name="Yes" sourceRef="sdncOk_ExclusiveGateway" targetRef="isSdncRpc4_ExclusiveGateway4"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_isSdncRollbackNeeded" ) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_isSdncRollbackNeeded" ) == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="sdncOk_No_ExclusiveGateway" name="No" sourceRef="sdncOk_ExclusiveGateway" targetRef="ExclusiveGateway_1qb2vwe" /> <bpmn2:scriptTask id="prepareSDNCRollbackRequest_ScriptTask" name="Prepare SDNCRollback Request" scriptFormat="groovy"> <bpmn2:incoming>isSdncRpc4No_SequenceFlow4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0lndbvr</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.prepareSDNCRollbackRequest(execution)]]></bpmn2:script> +DoCreateNetworkInstance.prepareSDNCRollbackRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="isSDNCActivate_ExclusiveGateway" name="is SDNC Activate Ok?" default="SequenceFlow_12tlymf"> <bpmn2:incoming>isPONR_No_SequenceFlow</bpmn2:incoming> @@ -155,7 +140,7 @@ DoCreateNetworkInstance.prepareSDNCRollbackRequest(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_12tlymf</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0cly7z2" name="Yes" sourceRef="isSDNCActivate_ExclusiveGateway" targetRef="Task_1imzwi3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_isSdncActivateRollbackNeeded" ) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_isSdncActivateRollbackNeeded" ) == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_12tlymf" name="No" sourceRef="isSDNCActivate_ExclusiveGateway" targetRef="ExclusiveGateway_1bk0tqd" /> <bpmn2:exclusiveGateway id="isSdncRpc4_ExclusiveGateway4" name="is not '1610' SNDC Call?" default="isSdncRpc4No_SequenceFlow4"> @@ -164,15 +149,15 @@ DoCreateNetworkInstance.prepareSDNCRollbackRequest(execution)]]></bpmn2:script> <bpmn2:outgoing>isSdncRpc4No_SequenceFlow4</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isSdncRpc4Yes_SequenceFlow4" name="Yes" sourceRef="isSdncRpc4_ExclusiveGateway4" targetRef="Task_0q6pzpn"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("sdncVersion") != '1610'} ]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("sdncVersion") != '1610'} </bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isSdncRpc4No_SequenceFlow4" name="No" sourceRef="isSdncRpc4_ExclusiveGateway4" targetRef="prepareSDNCRollbackRequest_ScriptTask" /> <bpmn2:scriptTask id="Task_0q6pzpn" name="Prepare RSRC SDNCRollback Request" scriptFormat="groovy"> <bpmn2:incoming>isSdncRpc4Yes_SequenceFlow4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0bwpkkb</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.prepareRpcSDNCRollbackRequest(execution)]]></bpmn2:script> +DoCreateNetworkInstance.prepareRpcSDNCRollbackRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:endEvent id="EndEvent_1kpt4kc"> <bpmn2:incoming>SequenceFlow_1qwubew</bpmn2:incoming> @@ -180,17 +165,17 @@ DoCreateNetworkInstance.prepareRpcSDNCRollbackRequest(execution)]]></bpmn2:scrip <bpmn2:scriptTask id="ScriptTask_0myjg9k" name="Prepare RollbackData" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_15sffxc</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_096tad6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.prepareRollbackData(execution)]]></bpmn2:script> +DoCreateNetworkInstance.prepareRollbackData(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0b8j5rw" sourceRef="Task_1imzwi3" targetRef="ExclusiveGateway_1bk0tqd" /> <bpmn2:scriptTask id="Task_1imzwi3" name="Prepare RSRC SDNC Activate Rollback Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0cly7z2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0b8j5rw</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.prepareRpcSDNCActivateRollback(execution)]]></bpmn2:script> +DoCreateNetworkInstance.prepareRpcSDNCActivateRollback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:callActivity id="CallActivity_1u07hp7" name="DoCreate NetworkInstanceRollback " calledElement="DoCreateNetworkInstanceRollback"> <bpmn2:extensionElements> @@ -218,9 +203,9 @@ DoCreateNetworkInstance.prepareRpcSDNCActivateRollback(execution)]]></bpmn2:scri <bpmn2:incoming>SequenceFlow_0vzsyrd</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_17nx822</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1qwubew</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.postProcessResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1qwubew" sourceRef="ScriptTask_0w2ekuz" targetRef="EndEvent_1kpt4kc" /> <bpmn2:exclusiveGateway id="isRollbackOn_ExclusiveGateway" name="Is Rollback On?" default="isRollbackOn_SequenceFlow_No"> @@ -229,7 +214,7 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> <bpmn2:outgoing>isRollbackOn_SequenceFlow_No</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isRollbackOn_SequenceFlow_Yes" name="Yes" sourceRef="isRollbackOn_ExclusiveGateway" targetRef="isPONR_ExclusiveGateway"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_rollbackEnabled") == true && execution.getVariable("CRENWKI_isSdncRollbackNeeded") == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_rollbackEnabled") == true && execution.getVariable("CRENWKI_isSdncRollbackNeeded") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isRollbackOn_SequenceFlow_No" name="No" sourceRef="isRollbackOn_ExclusiveGateway" targetRef="ExclusiveGateway_1umhuft" /> <bpmn2:inclusiveGateway id="ExclusiveGateway_1qb2vwe"> @@ -254,24 +239,26 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0j3058g" name="Set Exception Flag" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10ttvwn</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.setExceptionFlag(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_10ttvwn" sourceRef="ScriptTask_0j3058g" targetRef="isRollbackOn_ExclusiveGateway" /> - <bpmn2:textAnnotation id="TextAnnotation_1py1p84"> <bpmn2:text><![CDATA[Â Â + <bpmn2:textAnnotation id="TextAnnotation_1py1p84"> + <bpmn2:text>Â Â Include ONLY inputs/varrables: Â rollbackData, as Map -rollbackSDNCRequest -rollbackActivateSDNCRequest -rollbackNetworkRequest WorkflowException -Â ]]></bpmn2:text> -</bpmn2:textAnnotation> +Â </bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_0nketgd" sourceRef="CallActivity_1u07hp7" targetRef="TextAnnotation_1py1p84" /> - <bpmn2:textAnnotation id="TextAnnotation_0wjpv6r"> <bpmn2:text>PO Network Rollback is created in validation.</bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:textAnnotation id="TextAnnotation_0wjpv6r"> + <bpmn2:text>PO Network Rollback is created in validation.</bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_0eolbkz" sourceRef="ExclusiveGateway_1bk0tqd" targetRef="TextAnnotation_0wjpv6r" /> </bpmn2:subProcess> <bpmn2:serviceTask id="callCreateNetwork_ServiceTask" name="Call Create Network"> @@ -279,8 +266,8 @@ WorkflowException <camunda:connector> <camunda:inputOutput> <camunda:inputParameter name="payload">${CRENWKI_createNetworkRequest}</camunda:inputParameter> - <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint", execution)} -]]></camunda:inputParameter> + <camunda:inputParameter name="url">${UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint", execution)} +</camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="Authorization">#{BasicAuthHeaderValuePO}</camunda:entry> @@ -302,25 +289,25 @@ WorkflowException <bpmn2:scriptTask id="callRESTReQueryNetworkID_ScriptTask" name="Call REST ReQuery Network Id in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTReQueryAAINetworkId(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTReQueryAAINetworkId(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="callRESTReQueryNetworkID_ScriptTask" targetRef="callRESTUpdateContrailNetwork_ScriptTask" /> <bpmn2:scriptTask id="callRESTUpdateContrailNetwork_ScriptTask" name="Call REST Update Contrail Network in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1ipz2ze</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:subProcess id="unexpectedErrors_SubProcess" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> <bpmn2:scriptTask id="ScriptTask_1" name="Log / Print Unexpected Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.processJavaException(execution)]]></bpmn2:script> +DoCreateNetworkInstance.processJavaException(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_1" /> <bpmn2:startEvent id="StartEvent_1"> @@ -335,52 +322,52 @@ DoCreateNetworkInstance.processJavaException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="callAAIQuery_scriptTask" name="Call REST Query Network Name In AAI" scriptFormat="groovy"> <bpmn2:incoming>isNameSentYes_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAINetworkName(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAINetworkName(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="callAAIQuery_scriptTask" targetRef="isAAIQueryNameOk_ExclusiveGateway" /> <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="callGetServiceInstance" targetRef="isNameSent_ExclusiveGateway" /> <bpmn2:scriptTask id="callRESTQueryVpnBinding_ScriptTask" name="Call REST Query Vpn Binding in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_16</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_15" name="" sourceRef="callRESTQueryVpnBinding_ScriptTask" targetRef="callRESTQueryNetworkPolicy_ScriptTask" /> <bpmn2:scriptTask id="callRESTQueryNetworkPolicy_ScriptTask" name="Call REST Query Network Policy in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="callRESTQueryNetworkPolicy_ScriptTask" targetRef="callRESTQueryNetworkTableRef_ScriptTask" /> <bpmn2:scriptTask id="prepareNetworkRequest_ScriptTask" name="Prepare Create Network Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_61</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.prepareCreateNetworkRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_61" name="" sourceRef="prepareNetworkRequest_ScriptTask" targetRef="callCreateNetwork_ServiceTask" /> <bpmn2:scriptTask id="callRESTQueryNetworkTableRef_ScriptTask" name="Call REST Query Network TableRef in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.callRESTQueryAAINetworkTableRef(execution)]]></bpmn2:script> +DoCreateNetworkInstance.callRESTQueryAAINetworkTableRef(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="callRESTQueryNetworkTableRef_ScriptTask" targetRef="prepareNetworkRequest_ScriptTask" /> <bpmn2:sequenceFlow id="SequenceFlow_1n61wit" sourceRef="createNetwork_startEvent" targetRef="ScriptTask_preprocess" /> <bpmn2:scriptTask id="ScriptTask_preprocess" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1n61wit</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ftylq3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.preProcessRequest(execution)]]></bpmn2:script> +DoCreateNetworkInstance.preProcessRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0ftylq3" sourceRef="ScriptTask_preprocess" targetRef="callGetServiceInstance" /> <bpmn2:exclusiveGateway id="isNameSent_ExclusiveGateway" name="is Network Name Sent? " default="isNameSentNo_SequenceFlow"> @@ -389,7 +376,7 @@ DoCreateNetworkInstance.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:outgoing>isNameSentNo_SequenceFlow</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isNameSentYes_SequenceFlow" name="Yes" sourceRef="isNameSent_ExclusiveGateway" targetRef="callAAIQuery_scriptTask"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_networkName") != ""}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_networkName") != ""}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isNameSentNo_SequenceFlow" name="No" sourceRef="isNameSent_ExclusiveGateway" targetRef="callRESTQueryCloudRegion_ScriptTask" /> <bpmn2:callActivity id="Task_1ipbwbj" name="Call SDNC RSRC Activate Adapter V1 " calledElement="sdncAdapter"> @@ -408,9 +395,9 @@ DoCreateNetworkInstance.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="Task_1rd6dg6" name="Prepare SDNC RSRC Activate Request" scriptFormat="groovy"> <bpmn2:incoming>isSdncRpc2Yes_SequenceFlow2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13deudk</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.prepareRpcSDNCActivateRequest(execution)]]></bpmn2:script> +DoCreateNetworkInstance.prepareRpcSDNCActivateRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="ExclusiveGateway_0n0ptg6" name="is SDNC PRC Activate Ok? " default="SequenceFlow_18ybfu5"> <bpmn2:incoming>SequenceFlow_1t03rs2</bpmn2:incoming> @@ -421,15 +408,15 @@ DoCreateNetworkInstance.prepareRpcSDNCActivateRequest(execution)]]></bpmn2:scrip <bpmn2:sequenceFlow id="SequenceFlow_08qibb9" sourceRef="Task_1ipbwbj" targetRef="validateSDNCActivate_Task" /> <bpmn2:sequenceFlow id="SequenceFlow_1t03rs2" sourceRef="validateSDNCActivate_Task" targetRef="ExclusiveGateway_0n0ptg6" /> <bpmn2:sequenceFlow id="SequenceFlow_1jia57e" name="Yes" sourceRef="ExclusiveGateway_0n0ptg6" targetRef="Task_0zzobg6"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CRENWKI_sdncResponseSuccess" ) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("CRENWKI_sdncResponseSuccess" ) == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_18ybfu5" name="No" sourceRef="ExclusiveGateway_0n0ptg6" targetRef="EndEvent_13v46cq" /> <bpmn2:scriptTask id="validateSDNCActivate_Task" name="Validate SDNCRSRC Activate Response " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_08qibb9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1t03rs2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.validateRpcSDNCActivateResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.validateRpcSDNCActivateResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:boundaryEvent id="BoundaryEvent_0vb26bm" attachedToRef="validateSDNCActivate_Task"> <bpmn2:outgoing>SequenceFlow_0s51ns0</bpmn2:outgoing> @@ -448,7 +435,7 @@ DoCreateNetworkInstance.validateRpcSDNCActivateResponse(execution)]]></bpmn2:scr </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isSdncRpc1No_SequenceFlow1" name="No" sourceRef="isSdncRpc1_ExclusiveGateway1" targetRef="prepareSDNCTopoRequest_ScriptTask" /> <bpmn2:sequenceFlow id="isSdncRpc1Yes_SequenceFlow1" name="Yes" sourceRef="isSdncRpc1_ExclusiveGateway1" targetRef="Task_10lubzj"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("sdncVersion") != '1610'} ]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("sdncVersion") != '1610'} </bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:callActivity id="Task_0pbtywn" name="Call SDNC RSRC Assign Adapter V1 " calledElement="sdncAdapter"> <bpmn2:extensionElements> @@ -471,16 +458,16 @@ DoCreateNetworkInstance.validateRpcSDNCActivateResponse(execution)]]></bpmn2:scr <bpmn2:outgoing>isSdncRpc2No_SequenceFlow2</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="isSdncRpc2Yes_SequenceFlow2" name="Yes" sourceRef="isSdncRpc2_ExclusiveGateway2" targetRef="Task_1rd6dg6"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("sdncVersion") != '1610'} ]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("sdncVersion") != '1610'} </bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="isSdncRpc2No_SequenceFlow2" name="No" sourceRef="isSdncRpc2_ExclusiveGateway2" targetRef="Task_0zzobg6" /> <bpmn2:scriptTask id="Task_10lubzj" name="Prepare Assign SDNC RPC Request" scriptFormat="groovy"> <bpmn2:incoming>isSdncRpc1Yes_SequenceFlow1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0j8bxnb</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.prepareRpcSDNCRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:endEvent id="EndEvent_1te02c4"> <bpmn2:incoming>SequenceFlow_1s8b1m1</bpmn2:incoming> @@ -493,28 +480,29 @@ DoCreateNetworkInstance.prepareRpcSDNCRequest(execution) <bpmn2:incoming>SequenceFlow_1jia57e</bpmn2:incoming> <bpmn2:incoming>isSdncRpc2No_SequenceFlow2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1s8b1m1</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.postProcessResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1ipz2ze" sourceRef="callRESTUpdateContrailNetwork_ScriptTask" targetRef="isSdncRpc2_ExclusiveGateway2" /> <bpmn2:scriptTask id="ScriptTask_0p3v749" name="Post Process Response" scriptFormat="groovy"> <bpmn2:incoming>isNetworkActiveYes_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18ylufb</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> +DoCreateNetworkInstance.postProcessResponse(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_18ylufb" sourceRef="ScriptTask_0p3v749" targetRef="EndEvent_0ti2ctu" /> <bpmn2:scriptTask id="callGetServiceInstance" name=" AAI Query (svc instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0ftylq3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def DoCreateNetworkInstance = new DoCreateNetworkInstance() -DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> +DoCreateNetworkInstance.getServiceInstance(execution)</bpmn2:script> </bpmn2:scriptTask> - <bpmn2:textAnnotation id="TextAnnotation_1orb6o6"> <bpmn2:text><![CDATA[if '200', Prepare PO Network Rollback]]></bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:textAnnotation id="TextAnnotation_1orb6o6"> + <bpmn2:text>if '200', Prepare PO Network Rollback</bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_0c315jr" sourceRef="validateCreatePONetwork_ScriptTask" targetRef="TextAnnotation_1orb6o6" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -537,8 +525,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_62" targetElement="_BPMNShape_ExclusiveGateway_62"> - <di:waypoint xsi:type="dc:Point" x="1026" y="8" /> - <di:waypoint xsi:type="dc:Point" x="1098" y="9" /> + <di:waypoint x="1026" y="8" /> + <di:waypoint x="1098" y="9" /> <bpmndi:BPMNLabel> <dc:Bounds x="1062" y="-6.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -546,50 +534,23 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_63" bpmnElement="validateCreatePONetwork_ScriptTask"> <dc:Bounds x="1457" y="1258" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="isAAIQueryNameNo_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_62" targetElement="_BPMNShape_ExclusiveGateway_64"> - <di:waypoint xsi:type="dc:Point" x="1123" y="34" /> - <di:waypoint xsi:type="dc:Point" x="1123" y="91" /> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="isAAIQueryNameNo_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_62" targetElement="_BPMNShape_InclusiveGateway_4"> + <di:waypoint x="1123" y="34" /> + <di:waypoint x="1123" y="116" /> + <di:waypoint x="1224" y="116" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1131" y="39.0514827586207" width="14" height="12" /> + <dc:Bounds x="1131" y="44" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="isAAIQueryNameYes_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_62" targetElement="_BPMNShape_ExclusiveGateway_73"> - <di:waypoint xsi:type="dc:Point" x="1148" y="9" /> - <di:waypoint xsi:type="dc:Point" x="1186" y="9" /> - <di:waypoint xsi:type="dc:Point" x="1186" y="9" /> - <di:waypoint xsi:type="dc:Point" x="1224" y="9" /> + <di:waypoint x="1148" y="9" /> + <di:waypoint x="1186" y="9" /> + <di:waypoint x="1186" y="9" /> + <di:waypoint x="1224" y="9" /> <bpmndi:BPMNLabel> <dc:Bounds x="1151" y="14.164179104477611" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_64" bpmnElement="isReturnCode404_ExclusiveGateway" isMarkerVisible="true"> - <dc:Bounds x="1098" y="91" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1026" y="110" width="65" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="isReturnCode404_No_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_64" targetElement="_BPMNShape_EndEvent_118"> - <di:waypoint xsi:type="dc:Point" x="1123" y="141" /> - <di:waypoint xsi:type="dc:Point" x="1123" y="187" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1132" y="138.4109225063519" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="isReturnCode404_Yes_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_64" targetElement="_BPMNShape_InclusiveGateway_4"> - <di:waypoint xsi:type="dc:Point" x="1148" y="116" /> - <di:waypoint xsi:type="dc:Point" x="1186" y="116" /> - <di:waypoint xsi:type="dc:Point" x="1186" y="116" /> - <di:waypoint xsi:type="dc:Point" x="1224" y="116" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1151" y="118.55844155844156" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_118" bpmnElement="aai_Error_EndEvent"> - <dc:Bounds x="1105" y="187" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1085" y="228" width="77" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_83" bpmnElement="callCreateNetwork_ServiceTask"> <dc:Bounds x="1454" y="1135" width="100" height="80" /> </bpmndi:BPMNShape> @@ -612,15 +573,15 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="sdncTopoNo_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_67" targetElement="_BPMNShape_EndEvent_124"> - <di:waypoint xsi:type="dc:Point" x="1665" y="545" /> - <di:waypoint xsi:type="dc:Point" x="1739" y="545" /> + <di:waypoint x="1665" y="545" /> + <di:waypoint x="1739" y="545" /> <bpmndi:BPMNLabel> <dc:Bounds x="1670" y="545.8651480742376" width="14" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="sdncTopoYes_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_67" targetElement="_BPMNShape_ScriptTask_133"> - <di:waypoint xsi:type="dc:Point" x="1615" y="545" /> - <di:waypoint xsi:type="dc:Point" x="1554" y="546" /> + <di:waypoint x="1615" y="545" /> + <di:waypoint x="1554" y="546" /> <bpmndi:BPMNLabel> <dc:Bounds x="1587" y="549.9992641545633" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -635,22 +596,22 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1590" y="276" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_67" targetElement="_BPMNShape_CallActivity_19"> - <di:waypoint xsi:type="dc:Point" x="1640" y="235" /> - <di:waypoint xsi:type="dc:Point" x="1640" y="276" /> + <di:waypoint x="1640" y="235" /> + <di:waypoint x="1640" y="276" /> <bpmndi:BPMNLabel> <dc:Bounds x="1655" y="255.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_CallActivity_19" targetElement="_BPMNShape_ScriptTask_131"> - <di:waypoint xsi:type="dc:Point" x="1640" y="356" /> - <di:waypoint xsi:type="dc:Point" x="1640" y="395" /> + <di:waypoint x="1640" y="356" /> + <di:waypoint x="1640" y="395" /> <bpmndi:BPMNLabel> <dc:Bounds x="1655" y="375.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_StartEvent_50"> - <di:waypoint xsi:type="dc:Point" x="143" y="1184" /> - <di:waypoint xsi:type="dc:Point" x="170" y="1184" /> + <di:waypoint x="143" y="1184" /> + <di:waypoint x="170" y="1184" /> <bpmndi:BPMNLabel> <dc:Bounds x="157" y="1169" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -659,10 +620,10 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1590" y="395" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_131" targetElement="_BPMNShape_ExclusiveGateway_67"> - <di:waypoint xsi:type="dc:Point" x="1640" y="475" /> - <di:waypoint xsi:type="dc:Point" x="1640" y="498" /> - <di:waypoint xsi:type="dc:Point" x="1640" y="498" /> - <di:waypoint xsi:type="dc:Point" x="1640" y="520" /> + <di:waypoint x="1640" y="475" /> + <di:waypoint x="1640" y="498" /> + <di:waypoint x="1640" y="498" /> + <di:waypoint x="1640" y="520" /> <bpmndi:BPMNLabel> <dc:Bounds x="1655" y="498" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -674,22 +635,22 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="isNetworkActiveYes_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_73"> - <di:waypoint xsi:type="dc:Point" x="1274" y="9" /> - <di:waypoint xsi:type="dc:Point" x="1335" y="9" /> + <di:waypoint x="1274" y="9" /> + <di:waypoint x="1335" y="9" /> <bpmndi:BPMNLabel> <dc:Bounds x="1275" y="14.380425096632202" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_44" bpmnElement="isNetworkActiveNo_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_73" targetElement="_BPMNShape_InclusiveGateway_4"> - <di:waypoint xsi:type="dc:Point" x="1249" y="34" /> - <di:waypoint xsi:type="dc:Point" x="1249" y="91" /> + <di:waypoint x="1249" y="34" /> + <di:waypoint x="1249" y="91" /> <bpmndi:BPMNLabel> <dc:Bounds x="1258" y="37.520779498373976" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_45" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_InclusiveGateway_4" targetElement="_BPMNShape_ScriptTask_245"> - <di:waypoint xsi:type="dc:Point" x="1249" y="141" /> - <di:waypoint xsi:type="dc:Point" x="1249" y="276" /> + <di:waypoint x="1249" y="141" /> + <di:waypoint x="1249" y="276" /> <bpmndi:BPMNLabel> <dc:Bounds x="1264" y="208.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -710,8 +671,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="1538" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_54" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_134" targetElement="_BPMNShape_ScriptTask_135"> - <di:waypoint xsi:type="dc:Point" x="1504" y="1472" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="1538" /> + <di:waypoint x="1504" y="1472" /> + <di:waypoint x="1504" y="1538" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="1505" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -720,28 +681,28 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="627" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ScriptTask_156" targetElement="_BPMNShape_ScriptTask_215"> - <di:waypoint xsi:type="dc:Point" x="1504" y="707" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="727" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="727" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="750" /> + <di:waypoint x="1504" y="707" /> + <di:waypoint x="1504" y="727" /> + <di:waypoint x="1504" y="727" /> + <di:waypoint x="1504" y="750" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="727" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_49" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_ScriptTask_133" targetElement="_BPMNShape_ScriptTask_156"> - <di:waypoint xsi:type="dc:Point" x="1504" y="585" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="606" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="606" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="627" /> + <di:waypoint x="1504" y="585" /> + <di:waypoint x="1504" y="606" /> + <di:waypoint x="1504" y="606" /> + <di:waypoint x="1504" y="627" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="606" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_87" bpmnElement="SequenceFlow_59" sourceElement="_BPMNShape_ServiceTask_83" targetElement="_BPMNShape_ScriptTask_63"> - <di:waypoint xsi:type="dc:Point" x="1505" y="1215" /> - <di:waypoint xsi:type="dc:Point" x="1505" y="1237" /> - <di:waypoint xsi:type="dc:Point" x="1505" y="1237" /> - <di:waypoint xsi:type="dc:Point" x="1505" y="1258" /> + <di:waypoint x="1505" y="1215" /> + <di:waypoint x="1505" y="1237" /> + <di:waypoint x="1505" y="1237" /> + <di:waypoint x="1505" y="1258" /> <bpmndi:BPMNLabel> <dc:Bounds x="1520" y="1237" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -750,10 +711,10 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="1009" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_89" bpmnElement="SequenceFlow_61" sourceElement="_BPMNShape_ScriptTask_157" targetElement="_BPMNShape_ServiceTask_83"> - <di:waypoint xsi:type="dc:Point" x="1504" y="1089" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="1111" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="1111" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="1135" /> + <di:waypoint x="1504" y="1089" /> + <di:waypoint x="1504" y="1111" /> + <di:waypoint x="1504" y="1111" /> + <di:waypoint x="1504" y="1135" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="1111" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -762,8 +723,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="750" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_60" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_215" targetElement="_BPMNShape_ScriptTask_333"> - <di:waypoint xsi:type="dc:Point" x="1504" y="830" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="879" /> + <di:waypoint x="1504" y="830" /> + <di:waypoint x="1504" y="879" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="854.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -775,16 +736,16 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_77" bpmnElement="isPONR_Yes_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_215"> - <di:waypoint xsi:type="dc:Point" x="354" y="1085" /> - <di:waypoint xsi:type="dc:Point" x="457" y="1085" /> - <di:waypoint xsi:type="dc:Point" x="457" y="1159" /> + <di:waypoint x="354" y="1085" /> + <di:waypoint x="457" y="1085" /> + <di:waypoint x="457" y="1159" /> <bpmndi:BPMNLabel> <dc:Bounds x="351" y="1088" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_85" bpmnElement="isPONR_No_SequenceFlow" sourceElement="_BPMNShape_ExclusiveGateway_215"> - <di:waypoint xsi:type="dc:Point" x="329" y="1060" /> - <di:waypoint xsi:type="dc:Point" x="329" y="1003" /> + <di:waypoint x="329" y="1060" /> + <di:waypoint x="329" y="1003" /> <bpmndi:BPMNLabel> <dc:Bounds x="339" y="1051" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -796,17 +757,17 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_92" bpmnElement="sdncOk_Yeso_ExclusiveGateway" sourceElement="_BPMNShape_ExclusiveGateway_217" targetElement="_BPMNShape_ScriptTask_261"> - <di:waypoint xsi:type="dc:Point" x="552" y="845" /> - <di:waypoint xsi:type="dc:Point" x="552" y="776" /> - <di:waypoint xsi:type="dc:Point" x="713" y="776" /> + <di:waypoint x="552" y="845" /> + <di:waypoint x="552" y="776" /> + <di:waypoint x="713" y="776" /> <bpmndi:BPMNLabel> <dc:Bounds x="559" y="829" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_93" bpmnElement="sdncOk_No_ExclusiveGateway" sourceElement="_BPMNShape_ExclusiveGateway_217"> - <di:waypoint xsi:type="dc:Point" x="551" y="894" /> - <di:waypoint xsi:type="dc:Point" x="551" y="978" /> - <di:waypoint xsi:type="dc:Point" x="713" y="978" /> + <di:waypoint x="551" y="894" /> + <di:waypoint x="551" y="978" /> + <di:waypoint x="713" y="978" /> <bpmndi:BPMNLabel> <dc:Bounds x="559" y="895" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -815,8 +776,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1199" y="276" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_53" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ScriptTask_245" targetElement="_BPMNShape_ScriptTask_67"> - <di:waypoint xsi:type="dc:Point" x="1299" y="316" /> - <di:waypoint xsi:type="dc:Point" x="1337" y="316" /> + <di:waypoint x="1299" y="316" /> + <di:waypoint x="1337" y="316" /> <bpmndi:BPMNLabel> <dc:Bounds x="1318" y="301" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -828,8 +789,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_69" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_BoundaryEvent_38" targetElement="_BPMNShape_EndEvent_124"> - <di:waypoint xsi:type="dc:Point" x="1702" y="488" /> - <di:waypoint xsi:type="dc:Point" x="1745" y="533" /> + <di:waypoint x="1702" y="488" /> + <di:waypoint x="1745" y="533" /> <bpmndi:BPMNLabel> <dc:Bounds x="1724" y="495.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -838,8 +799,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="886" y="830" width="100" height="79" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_63" targetElement="_BPMNShape_ScriptTask_134"> - <di:waypoint xsi:type="dc:Point" x="1507" y="1338" /> - <di:waypoint xsi:type="dc:Point" x="1505" y="1392" /> + <di:waypoint x="1507" y="1338" /> + <di:waypoint x="1505" y="1392" /> <bpmndi:BPMNLabel> <dc:Bounds x="1506" y="1350" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -863,23 +824,23 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_270"> - <di:waypoint xsi:type="dc:Point" x="90" y="476" /> - <di:waypoint xsi:type="dc:Point" x="169" y="476" /> + <di:waypoint x="90" y="476" /> + <di:waypoint x="169" y="476" /> <bpmndi:BPMNLabel> <dc:Bounds x="129" y="476" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_270" targetElement="_BPMNShape_EndEvent_220"> - <di:waypoint xsi:type="dc:Point" x="269" y="476" /> - <di:waypoint xsi:type="dc:Point" x="330" y="476" /> + <di:waypoint x="269" y="476" /> + <di:waypoint x="330" y="476" /> <bpmndi:BPMNLabel> <dc:Bounds x="301" y="476" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="ScriptTask_0z2n0hl_di" targetElement="ExclusiveGateway_0lw40k5_di"> - <di:waypoint xsi:type="dc:Point" x="809" y="235" /> - <di:waypoint xsi:type="dc:Point" x="809" y="316" /> - <di:waypoint xsi:type="dc:Point" x="951" y="316" /> + <di:waypoint x="809" y="235" /> + <di:waypoint x="809" y="316" /> + <di:waypoint x="951" y="316" /> <bpmndi:BPMNLabel> <dc:Bounds x="779" y="275.5" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -888,19 +849,19 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="879" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_333" targetElement="_BPMNShape_ScriptTask_157"> - <di:waypoint xsi:type="dc:Point" x="1504" y="959" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="981" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="981" /> - <di:waypoint xsi:type="dc:Point" x="1504" y="1009" /> + <di:waypoint x="1504" y="959" /> + <di:waypoint x="1504" y="981" /> + <di:waypoint x="1504" y="981" /> + <di:waypoint x="1504" y="1009" /> <bpmndi:BPMNLabel> <dc:Bounds x="1519" y="981" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1n61wit_di" bpmnElement="SequenceFlow_1n61wit"> - <di:waypoint xsi:type="dc:Point" x="433" y="195" /> - <di:waypoint xsi:type="dc:Point" x="492" y="195" /> - <di:waypoint xsi:type="dc:Point" x="492" y="195" /> - <di:waypoint xsi:type="dc:Point" x="546" y="195" /> + <di:waypoint x="433" y="195" /> + <di:waypoint x="492" y="195" /> + <di:waypoint x="492" y="195" /> + <di:waypoint x="546" y="195" /> <bpmndi:BPMNLabel> <dc:Bounds x="507" y="195" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -909,10 +870,10 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="546" y="155" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ftylq3_di" bpmnElement="SequenceFlow_0ftylq3"> - <di:waypoint xsi:type="dc:Point" x="646" y="195" /> - <di:waypoint xsi:type="dc:Point" x="706" y="195" /> - <di:waypoint xsi:type="dc:Point" x="706" y="195" /> - <di:waypoint xsi:type="dc:Point" x="759" y="195" /> + <di:waypoint x="646" y="195" /> + <di:waypoint x="706" y="195" /> + <di:waypoint x="706" y="195" /> + <di:waypoint x="759" y="195" /> <bpmndi:BPMNLabel> <dc:Bounds x="676" y="195" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -924,17 +885,17 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0635hhm_di" bpmnElement="isNameSentYes_SequenceFlow"> - <di:waypoint xsi:type="dc:Point" x="976" y="291" /> - <di:waypoint xsi:type="dc:Point" x="976" y="170" /> - <di:waypoint xsi:type="dc:Point" x="976" y="170" /> - <di:waypoint xsi:type="dc:Point" x="976" y="49" /> + <di:waypoint x="976" y="291" /> + <di:waypoint x="976" y="170" /> + <di:waypoint x="976" y="170" /> + <di:waypoint x="976" y="49" /> <bpmndi:BPMNLabel> <dc:Bounds x="988" y="275" width="18" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1sirjgc_di" bpmnElement="isNameSentNo_SequenceFlow"> - <di:waypoint xsi:type="dc:Point" x="1001" y="316" /> - <di:waypoint xsi:type="dc:Point" x="1199" y="316" /> + <di:waypoint x="1001" y="316" /> + <di:waypoint x="1199" y="316" /> <bpmndi:BPMNLabel> <dc:Bounds x="1005" y="328" width="14" height="13" /> </bpmndi:BPMNLabel> @@ -952,36 +913,36 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13deudk_di" bpmnElement="SequenceFlow_13deudk"> - <di:waypoint xsi:type="dc:Point" x="1183" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="1114" y="1578" /> + <di:waypoint x="1183" y="1578" /> + <di:waypoint x="1114" y="1578" /> <bpmndi:BPMNLabel> <dc:Bounds x="1149" y="1563" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_08qibb9_di" bpmnElement="SequenceFlow_08qibb9"> - <di:waypoint xsi:type="dc:Point" x="1014" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="953" y="1578" /> + <di:waypoint x="1014" y="1578" /> + <di:waypoint x="953" y="1578" /> <bpmndi:BPMNLabel> <dc:Bounds x="984" y="1563" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1t03rs2_di" bpmnElement="SequenceFlow_1t03rs2"> - <di:waypoint xsi:type="dc:Point" x="853" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="774" y="1578" /> + <di:waypoint x="853" y="1578" /> + <di:waypoint x="774" y="1578" /> <bpmndi:BPMNLabel> <dc:Bounds x="814" y="1563" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1jia57e_di" bpmnElement="SequenceFlow_1jia57e"> - <di:waypoint xsi:type="dc:Point" x="749" y="1553" /> - <di:waypoint xsi:type="dc:Point" x="749" y="1484" /> + <di:waypoint x="749" y="1553" /> + <di:waypoint x="749" y="1484" /> <bpmndi:BPMNLabel> <dc:Bounds x="757" y="1537.7047949008065" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18ybfu5_di" bpmnElement="SequenceFlow_18ybfu5"> - <di:waypoint xsi:type="dc:Point" x="749" y="1603" /> - <di:waypoint xsi:type="dc:Point" x="749" y="1669" /> + <di:waypoint x="749" y="1603" /> + <di:waypoint x="749" y="1669" /> <bpmndi:BPMNLabel> <dc:Bounds x="758" y="1603.7606668519034" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -996,9 +957,9 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0s51ns0_di" bpmnElement="SequenceFlow_0s51ns0"> - <di:waypoint xsi:type="dc:Point" x="877" y="1636" /> - <di:waypoint xsi:type="dc:Point" x="877" y="1687" /> - <di:waypoint xsi:type="dc:Point" x="767" y="1687" /> + <di:waypoint x="877" y="1636" /> + <di:waypoint x="877" y="1687" /> + <di:waypoint x="767" y="1687" /> <bpmndi:BPMNLabel> <dc:Bounds x="892" y="1661.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1016,16 +977,16 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0cly7z2_di" bpmnElement="SequenceFlow_0cly7z2"> - <di:waypoint xsi:type="dc:Point" x="329" y="953" /> - <di:waypoint xsi:type="dc:Point" x="329" y="910" /> + <di:waypoint x="329" y="953" /> + <di:waypoint x="329" y="910" /> <bpmndi:BPMNLabel> <dc:Bounds x="335" y="937" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12tlymf_di" bpmnElement="SequenceFlow_12tlymf"> - <di:waypoint xsi:type="dc:Point" x="354" y="978" /> - <di:waypoint xsi:type="dc:Point" x="457" y="978" /> - <di:waypoint xsi:type="dc:Point" x="457" y="895" /> + <di:waypoint x="354" y="978" /> + <di:waypoint x="457" y="978" /> + <di:waypoint x="457" y="895" /> <bpmndi:BPMNLabel> <dc:Bounds x="350" y="988" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -1037,16 +998,16 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1r5sja0_di" bpmnElement="isSdncRpc1No_SequenceFlow1"> - <di:waypoint xsi:type="dc:Point" x="1362" y="291" /> - <di:waypoint xsi:type="dc:Point" x="1362" y="195" /> - <di:waypoint xsi:type="dc:Point" x="1590" y="195" /> + <di:waypoint x="1362" y="291" /> + <di:waypoint x="1362" y="195" /> + <di:waypoint x="1590" y="195" /> <bpmndi:BPMNLabel> <dc:Bounds x="1371" y="273" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ow57qy_di" bpmnElement="isSdncRpc1Yes_SequenceFlow1"> - <di:waypoint xsi:type="dc:Point" x="1362" y="341" /> - <di:waypoint xsi:type="dc:Point" x="1362" y="395" /> + <di:waypoint x="1362" y="341" /> + <di:waypoint x="1362" y="395" /> <bpmndi:BPMNLabel> <dc:Bounds x="1373" y="341" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -1055,15 +1016,15 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1454" y="395" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0j8bxnb_di" bpmnElement="SequenceFlow_0j8bxnb"> - <di:waypoint xsi:type="dc:Point" x="1412" y="435" /> - <di:waypoint xsi:type="dc:Point" x="1454" y="435" /> + <di:waypoint x="1412" y="435" /> + <di:waypoint x="1454" y="435" /> <bpmndi:BPMNLabel> <dc:Bounds x="1433" y="420" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0d93bqw_di" bpmnElement="SequenceFlow_0d93bqw"> - <di:waypoint xsi:type="dc:Point" x="1554" y="435" /> - <di:waypoint xsi:type="dc:Point" x="1590" y="435" /> + <di:waypoint x="1554" y="435" /> + <di:waypoint x="1590" y="435" /> <bpmndi:BPMNLabel> <dc:Bounds x="1572" y="420" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1075,16 +1036,16 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0suu90e_di" bpmnElement="isSdncRpc4Yes_SequenceFlow4"> - <di:waypoint xsi:type="dc:Point" x="738" y="801" /> - <di:waypoint xsi:type="dc:Point" x="738" y="830" /> + <di:waypoint x="738" y="801" /> + <di:waypoint x="738" y="830" /> <bpmndi:BPMNLabel> <dc:Bounds x="743" y="800" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xnyl6e_di" bpmnElement="isSdncRpc4No_SequenceFlow4"> - <di:waypoint xsi:type="dc:Point" x="763" y="776" /> - <di:waypoint xsi:type="dc:Point" x="936" y="776" /> - <di:waypoint xsi:type="dc:Point" x="936" y="830" /> + <di:waypoint x="763" y="776" /> + <di:waypoint x="936" y="776" /> + <di:waypoint x="936" y="830" /> <bpmndi:BPMNLabel> <dc:Bounds x="772" y="755" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -1096,16 +1057,16 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lphs99_di" bpmnElement="isSdncRpc2Yes_SequenceFlow2"> - <di:waypoint xsi:type="dc:Point" x="1360" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="1283" y="1578" /> + <di:waypoint x="1360" y="1578" /> + <di:waypoint x="1283" y="1578" /> <bpmndi:BPMNLabel> <dc:Bounds x="1337" y="1580.0388981849903" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0lk1uut_di" bpmnElement="isSdncRpc2No_SequenceFlow2"> - <di:waypoint xsi:type="dc:Point" x="1385" y="1553" /> - <di:waypoint xsi:type="dc:Point" x="1385" y="1444" /> - <di:waypoint xsi:type="dc:Point" x="799" y="1444" /> + <di:waypoint x="1385" y="1553" /> + <di:waypoint x="1385" y="1444" /> + <di:waypoint x="799" y="1444" /> <bpmndi:BPMNLabel> <dc:Bounds x="1362" y="1543.660178848007" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -1135,10 +1096,10 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1s8b1m1_di" bpmnElement="SequenceFlow_1s8b1m1"> - <di:waypoint xsi:type="dc:Point" x="699" y="1444" /> - <di:waypoint xsi:type="dc:Point" x="597" y="1444" /> - <di:waypoint xsi:type="dc:Point" x="597" y="1444" /> - <di:waypoint xsi:type="dc:Point" x="503" y="1444" /> + <di:waypoint x="699" y="1444" /> + <di:waypoint x="597" y="1444" /> + <di:waypoint x="597" y="1444" /> + <di:waypoint x="503" y="1444" /> <bpmndi:BPMNLabel> <dc:Bounds x="612" y="1444" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1150,8 +1111,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="688" y="1053" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0b8j5rw_di" bpmnElement="SequenceFlow_0b8j5rw"> - <di:waypoint xsi:type="dc:Point" x="379" y="870" /> - <di:waypoint xsi:type="dc:Point" x="432" y="870" /> + <di:waypoint x="379" y="870" /> + <di:waypoint x="432" y="870" /> <bpmndi:BPMNLabel> <dc:Bounds x="406" y="855" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1160,10 +1121,10 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="279" y="830" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ipz2ze_di" bpmnElement="SequenceFlow_1ipz2ze"> - <di:waypoint xsi:type="dc:Point" x="1454" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="1432" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="1432" y="1578" /> - <di:waypoint xsi:type="dc:Point" x="1410" y="1578" /> + <di:waypoint x="1454" y="1578" /> + <di:waypoint x="1432" y="1578" /> + <di:waypoint x="1432" y="1578" /> + <di:waypoint x="1410" y="1578" /> <bpmndi:BPMNLabel> <dc:Bounds x="1447" y="1578" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1172,30 +1133,30 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="841" y="1053" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vzsyrd_di" bpmnElement="SequenceFlow_0vzsyrd"> - <di:waypoint xsi:type="dc:Point" x="941" y="1093" /> - <di:waypoint xsi:type="dc:Point" x="1007" y="1093" /> + <di:waypoint x="941" y="1093" /> + <di:waypoint x="1007" y="1093" /> <bpmndi:BPMNLabel> <dc:Bounds x="974" y="1078" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0bwpkkb_di" bpmnElement="SequenceFlow_0bwpkkb"> - <di:waypoint xsi:type="dc:Point" x="738" y="910" /> - <di:waypoint xsi:type="dc:Point" x="738" y="953" /> + <di:waypoint x="738" y="910" /> + <di:waypoint x="738" y="953" /> <bpmndi:BPMNLabel> <dc:Bounds x="753" y="922" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0lndbvr_di" bpmnElement="SequenceFlow_0lndbvr"> - <di:waypoint xsi:type="dc:Point" x="936" y="909" /> - <di:waypoint xsi:type="dc:Point" x="936" y="978" /> - <di:waypoint xsi:type="dc:Point" x="763" y="978" /> + <di:waypoint x="936" y="909" /> + <di:waypoint x="936" y="978" /> + <di:waypoint x="763" y="978" /> <bpmndi:BPMNLabel> <dc:Bounds x="951" y="944" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_096tad6_di" bpmnElement="SequenceFlow_096tad6"> - <di:waypoint xsi:type="dc:Point" x="788" y="1093" /> - <di:waypoint xsi:type="dc:Point" x="841" y="1093" /> + <di:waypoint x="788" y="1093" /> + <di:waypoint x="841" y="1093" /> <bpmndi:BPMNLabel> <dc:Bounds x="815" y="1078" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1204,15 +1165,15 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1036" y="901" width="252" height="119" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0nketgd_di" bpmnElement="Association_0nketgd"> - <di:waypoint xsi:type="dc:Point" x="941" y="1069" /> - <di:waypoint xsi:type="dc:Point" x="1041" y="1020" /> + <di:waypoint x="941" y="1069" /> + <di:waypoint x="1041" y="1020" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0w2ekuz_di" bpmnElement="ScriptTask_0w2ekuz"> <dc:Bounds x="1007" y="1053" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qwubew_di" bpmnElement="SequenceFlow_1qwubew"> - <di:waypoint xsi:type="dc:Point" x="1107" y="1093" /> - <di:waypoint xsi:type="dc:Point" x="1160" y="1093" /> + <di:waypoint x="1107" y="1093" /> + <di:waypoint x="1160" y="1093" /> <bpmndi:BPMNLabel> <dc:Bounds x="1134" y="1068" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1224,15 +1185,15 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_19kcbiw_di" bpmnElement="isRollbackOn_SequenceFlow_Yes"> - <di:waypoint xsi:type="dc:Point" x="329" y="1159" /> - <di:waypoint xsi:type="dc:Point" x="329" y="1110" /> + <di:waypoint x="329" y="1159" /> + <di:waypoint x="329" y="1110" /> <bpmndi:BPMNLabel> <dc:Bounds x="337" y="1142" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0pl3e54_di" bpmnElement="isRollbackOn_SequenceFlow_No"> - <di:waypoint xsi:type="dc:Point" x="354" y="1184" /> - <di:waypoint xsi:type="dc:Point" x="432" y="1184" /> + <di:waypoint x="354" y="1184" /> + <di:waypoint x="432" y="1184" /> <bpmndi:BPMNLabel> <dc:Bounds x="355" y="1190" width="14" height="12" /> </bpmndi:BPMNLabel> @@ -1244,8 +1205,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15sffxc_di" bpmnElement="SequenceFlow_15sffxc"> - <di:waypoint xsi:type="dc:Point" x="738" y="1003" /> - <di:waypoint xsi:type="dc:Point" x="738" y="1053" /> + <di:waypoint x="738" y="1003" /> + <di:waypoint x="738" y="1053" /> <bpmndi:BPMNLabel> <dc:Bounds x="753" y="1028" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1257,8 +1218,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0k7y7b5_di" bpmnElement="SequenceFlow_0k7y7b5"> - <di:waypoint xsi:type="dc:Point" x="482" y="870" /> - <di:waypoint xsi:type="dc:Point" x="527" y="870" /> + <di:waypoint x="482" y="870" /> + <di:waypoint x="527" y="870" /> <bpmndi:BPMNLabel> <dc:Bounds x="505" y="845" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1267,8 +1228,8 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1335" y="-31" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18ylufb_di" bpmnElement="SequenceFlow_18ylufb"> - <di:waypoint xsi:type="dc:Point" x="1435" y="9" /> - <di:waypoint xsi:type="dc:Point" x="1486" y="9" /> + <di:waypoint x="1435" y="9" /> + <di:waypoint x="1486" y="9" /> <bpmndi:BPMNLabel> <dc:Bounds x="1461" y="-6" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1280,9 +1241,9 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_17nx822_di" bpmnElement="SequenceFlow_17nx822"> - <di:waypoint xsi:type="dc:Point" x="482" y="1184" /> - <di:waypoint xsi:type="dc:Point" x="1057" y="1184" /> - <di:waypoint xsi:type="dc:Point" x="1057" y="1133" /> + <di:waypoint x="482" y="1184" /> + <di:waypoint x="1057" y="1184" /> + <di:waypoint x="1057" y="1133" /> <bpmndi:BPMNLabel> <dc:Bounds x="770" y="1169" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -1291,22 +1252,22 @@ DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="1606" y="1241" width="233" height="37" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0c315jr_di" bpmnElement="Association_0c315jr"> - <di:waypoint xsi:type="dc:Point" x="1557" y="1289" /> - <di:waypoint xsi:type="dc:Point" x="1621" y="1278" /> + <di:waypoint x="1557" y="1289" /> + <di:waypoint x="1621" y="1278" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="TextAnnotation_0wjpv6r_di" bpmnElement="TextAnnotation_0wjpv6r"> <dc:Bounds x="341" y="735" width="180" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0eolbkz_di" bpmnElement="Association_0eolbkz"> - <di:waypoint xsi:type="dc:Point" x="452" y="850" /> - <di:waypoint xsi:type="dc:Point" x="435" y="771" /> + <di:waypoint x="452" y="850" /> + <di:waypoint x="435" y="771" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0j3058g_di" bpmnElement="ScriptTask_0j3058g"> <dc:Bounds x="170" y="1144" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_10ttvwn_di" bpmnElement="SequenceFlow_10ttvwn"> - <di:waypoint xsi:type="dc:Point" x="270" y="1184" /> - <di:waypoint xsi:type="dc:Point" x="304" y="1184" /> + <di:waypoint x="270" y="1184" /> + <di:waypoint x="304" y="1184" /> <bpmndi:BPMNLabel> <dc:Bounds x="287" y="1159" width="0" height="0" /> </bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 17f6c66e4a..6084f570ce 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -189,7 +189,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <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:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -206,12 +206,12 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "No actual resoure in service instance") def csi= new DoDeleteE2EServiceInstance() -csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script> +csi.prepareUpdateServiceOperationStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process"> <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml index a1905f85f6..daf7279b70 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml @@ -131,6 +131,10 @@ mso: service-plugin: third-sp-endpoint: oof-calc-endpoint: +org: + onap: + so: + cloud-owner: CloudOwner policy: auth: Basic dGVzdHBkcDphbHBoYTEyMw== client: diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml index e5cb7e096e..b1a8c4be07 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml @@ -215,6 +215,10 @@ mso: callback: http://localhost:30253/mso/vnfAdapterNotify rollback: callback: http://localhost:30253/mso/vnfAdapterNotify +org: + onap: + so: + cloud-owner: CloudOwner policy: auth: Basic dGVzdHBkcDphbHBoYTEyMw== client: diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 63a65cdc24..becb66a6dc 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -44,6 +44,36 @@ </execution> </executions> </plugin> + <plugin> + <groupId>io.swagger</groupId> + <artifactId>swagger-codegen-maven-plugin</artifactId> + <version>2.3.1</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <inputSpec>${project.basedir}/src/main/resources/naming-service/swagger.json</inputSpec> + <apiPackage>org.onap.namingservice.api</apiPackage> + <modelPackage>org.onap.namingservice.model</modelPackage> + <invokerPackage>org.onap.namingservice.invoker</invokerPackage> + </configuration> + </execution> + </executions> + <configuration> + <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec> + <language>java</language> + <configOptions> + <sourceFolder>src/gen/java/main</sourceFolder> + <serializableModel>true</serializableModel> + </configOptions> + <output>${project.build.directory}/generated-sources</output> + <generateApis>false</generateApis> + <library>jersey2</library> + <generateSupportingFiles>false</generateSupportingFiles> + </configuration> + </plugin> </plugins> </build> <dependencyManagement> @@ -79,8 +109,6 @@ <dependency> <groupId>org.camunda.bpm.extension.mockito</groupId> <artifactId>camunda-bpm-mockito</artifactId> - <version>3.2.1</version> - <scope>test</scope> </dependency> <dependency> <groupId>org.onap.so</groupId> @@ -95,7 +123,7 @@ <dependency> <groupId>org.onap.sdnc.northbound</groupId> <artifactId>generic-resource-api-client</artifactId> - <version>1.4.1</version> + <version>1.5.0-SNAPSHOT</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 887c51e179..4a3cb01b74 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -20,8 +20,13 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -52,6 +57,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component @@ -78,6 +84,8 @@ public class AAICreateTasks { private AAIVpnBindingResources aaiVpnBindingResources; @Autowired private AAIConfigurationResources aaiConfigurationResources; + @Autowired + private Environment env; public void createServiceInstance(BuildingBlockExecution execution) { try { @@ -354,6 +362,41 @@ public class AAICreateTasks { * @param execution * @throws Exception */ + public void connectVnfToCloudRegion(BuildingBlockExecution execution) { + try { + boolean cloudRegionsToSkip = false; + String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class); + if (cloudRegions != null){ + cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals); + } + if(!cloudRegionsToSkip) { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion()); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectVnfToTenant(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVnfResources.connectVnfToTenant(vnf, execution.getGeneralBuildingBlock().getCloudRegion()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 38261c0f1a..ed6379a6a4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -156,7 +156,9 @@ public class AAIUpdateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); String heatStackId = execution.getVariable("heatStackId"); - + if (heatStackId == null) { + heatStackId = ""; + } VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); CloudRegion cloudRegion = gBBInput.getCloudRegion(); volumeGroup.setHeatStackId(heatStackId); @@ -320,6 +322,9 @@ public class AAIUpdateTasks { public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { try { String heatStackId = execution.getVariable("heatStackId"); + if (heatStackId == null) { + heatStackId = ""; + } VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); vfModule.setHeatStackId(heatStackId); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java index 534e93637a..ee80ba4c55 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java @@ -58,7 +58,7 @@ public class AssignVnf { aaiInstanceGroupResources.createInstanceGroup(instanceGroup); aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO); } - else if(ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { + else if(ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java new file mode 100644 index 0000000000..cb4ac5c9d9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java @@ -0,0 +1,56 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.namingservice.tasks; + + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.NamingServiceResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NamingServiceCreateTasks { + + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private NamingServiceResources namingServiceResources; + + public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception { + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + String policyInstanceName = execution.getVariable("policyInstanceName"); + String nfNamingCode = execution.getVariable("nfNamingCode"); + String generatedInstanceGroupName = ""; + try { + generatedInstanceGroupName = namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + instanceGroup.setInstanceGroupName(generatedInstanceGroupName); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java new file mode 100644 index 0000000000..ddea2724bc --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java @@ -0,0 +1,53 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.namingservice.tasks; + + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.NamingServiceResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NamingServiceDeleteTasks { + + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private NamingServiceResources namingServiceResources; + + public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception { + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + + try { + namingServiceResources.deleteInstanceGroupName(instanceGroup); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index e587e80251..43ee71e676 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -20,6 +20,9 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -36,6 +39,8 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -63,8 +68,11 @@ public class SDNCActivateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); - String response = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCResponse", response); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VNF); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -76,18 +84,18 @@ public class SDNCActivateTasks { * @throws BBObjectNotFoundException */ public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException { - execution.setVariable("sdncNetworkActivateRollback", false); - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - Customer customer = gBBInput.getCustomer(); - RequestContext requestContext = gBBInput.getRequestContext(); - CloudRegion cloudRegion = gBBInput.getCloudRegion(); - try { - sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); - execution.setVariable("sdncNetworkActivateRollback", true); + try{ + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.NETWORK); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -108,12 +116,12 @@ public class SDNCActivateTasks { execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - execution.setVariable("sdncActivateVfModuleRollback", false); - - String response = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCActivateVfModuleResponse", response); - execution.setVariable("sdncActivateVfModuleRollback", true); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VFMODULE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index 30f38fc2ed..2695a170b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -20,6 +20,9 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -67,8 +70,11 @@ public class SDNCAssignTasks { RequestContext requestContext = gBBInput.getRequestContext(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); Customer customer = gBBInput.getCustomer(); - String response = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext); - execution.setVariable("SDNCResponse", response); + GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.SERVICE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -107,9 +113,11 @@ public class SDNCAssignTasks { } Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response); + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VFMODULE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -123,15 +131,16 @@ public class SDNCAssignTasks { public void assignNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); + GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.NETWORK); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index cae4dc26de..592b831d62 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -20,6 +20,10 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -36,6 +40,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCServiceInstanceResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -58,9 +64,11 @@ public class SDNCChangeAssignTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - String response = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext()); - execution.setVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response", response); + GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext()); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.SERVICE); + execution.setVariable("SDNCRequest", sdncRequest); } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -71,9 +79,11 @@ public class SDNCChangeAssignTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - String response = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext()); - execution.setVariable("SDNCChangeModelVnfResponse", response); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext()); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VNF); + execution.setVariable("SDNCRequest", sdncRequest); } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -84,9 +94,11 @@ public class SDNCChangeAssignTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - String sdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion()); - execution.setVariable("SDNCChangeAssignNetworkResponse", sdncResponse); + GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion()); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.NETWORK); + execution.setVariable("SDNCRequest", sdncRequest); } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -101,8 +113,11 @@ public class SDNCChangeAssignTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); Customer customer = gBBInput.getCustomer(); - String response = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCChangeAssignVfModuleResponse", response); + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VFMODULE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 1f6ec72f34..eb078e04b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -20,6 +20,10 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -36,6 +40,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCServiceInstanceResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -61,23 +67,17 @@ public class SDNCDeactivateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, - execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, - execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, - execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - execution.setVariable("sdncDeactivateVfModuleRollback", false); - - String response = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCDeactivateVfModuleResponse", response); - execution.setVariable("sdncDeactivateVfModuleRollback", true); - } catch (Exception ex) { + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VFMODULE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -93,15 +93,15 @@ public class SDNCDeactivateTasks { RequestContext requestContext = gBBInput.getRequestContext(); ServiceInstance serviceInstance = null; GenericVnf vnf = null; - - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, - execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, - execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); - String response = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("SDNCDeactivateVnfResponse", response); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VNF); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -119,10 +119,11 @@ public class SDNCDeactivateTasks { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); Customer customer = gBBInput.getCustomer(); - execution.setVariable("sdncServiceInstanceRollback", false); - String response = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext); - execution.setVariable("deactivateServiceInstanceSDNCResponse", response); - execution.setVariable("sdncServiceInstanceRollback", true); + GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.SERVICE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -134,7 +135,6 @@ public class SDNCDeactivateTasks { * @param execution */ public void deactivateNetwork(BuildingBlockExecution execution) { - execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", false); try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); @@ -142,11 +142,12 @@ public class SDNCDeactivateTasks { Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - String response = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer, + GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer, requestContext, cloudRegion); - execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.response", response); - execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", true); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.NETWORK); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 4506699ce8..81ebfb1f41 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -75,7 +75,9 @@ public class SDNCQueryTasks { + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/"; try { - vfModule.setSelflink(selfLink); + if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) { + vfModule.setSelflink(selfLink); + } if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index fedec4f732..173d5f7e73 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; @@ -32,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.PathNotFoundException; @Component public class SDNCRequestTasks { @@ -61,6 +63,9 @@ public class SDNCRequestTasks { String response = sdncClient.post(request.getSDNCPayload(),request.getTopology()); String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator"); execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator)); + } catch(PathNotFoundException e) { + logger.error("Error Parsing SDNC Response", e); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response"); } catch (MapperException e) { logger.error("Error Parsing SDNC Response", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response"); @@ -86,11 +91,6 @@ public class SDNCRequestTasks { public void handleTimeOutException (DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response"); } - - public void handleSyncError (DelegateExecution execution) { - String msg = (String) execution.getVariable("SDNCSyncError"); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); - } protected boolean convertIndicatorToBoolean(String finalMessageIndicator) { return "Y".equals(finalMessageIndicator); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 13639daa44..960fb9988a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -20,10 +20,15 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -31,17 +36,16 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCServiceInstanceResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; -import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; -import org.onap.so.client.orchestration.SDNCNetworkResources; - @Component public class SDNCUnassignTasks { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCUnassignTasks.class); @@ -62,15 +66,13 @@ public class SDNCUnassignTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - if (serviceInstance.getOrchestrationStatus() == OrchestrationStatus.INVENTORIED) { - return; // If INVENTORIED then SDNC unassign is not necessary - } - RequestContext requestContext = gBBInput.getRequestContext(); Customer customer = gBBInput.getCustomer(); - String sdncUnassignResponse = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext); - execution.setVariable("sdncUnassignResponse", sdncUnassignResponse); + GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.SERVICE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -81,17 +83,11 @@ public class SDNCUnassignTasks { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - - if (OrchestrationStatus.INVENTORIED == vfModule.getOrchestrationStatus() || OrchestrationStatus.PENDING_CREATE == vfModule.getOrchestrationStatus()) { - return; // If INVENTORIED or PENDING_CREATE then SDNC unassign is not necessary - } - - execution.setVariable("sdncVfModuleRollback", false); - - String response = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); - execution.setVariable("SDNCResponse", response); - execution.setVariable("sdncVfModuleRollback", true); - } catch (Exception ex) { + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VFMODULE); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -101,41 +97,34 @@ public class SDNCUnassignTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - - if (OrchestrationStatus.INVENTORIED == vnf.getOrchestrationStatus() || OrchestrationStatus.CREATED == vnf.getOrchestrationStatus()) { - return; // If INVENTORIED or CREATED then SDNC unassign is not necessary - } - RequestContext requestContext = gBBInput.getRequestContext(); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - execution.setVariable("sdncVnfRollback", false); - String response = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); - execution.setVariable("sdncUnassignVnfResponse", response); - execution.setVariable("sdncVnfRollback", true); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VNF); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } public void unassignNetwork(BuildingBlockExecution execution) throws Exception { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - - if (OrchestrationStatus.INVENTORIED == network.getOrchestrationStatus()) { - return; // If INVENTORIED then SDNC unassign is not necessary - } - - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - Customer customer = gBBInput.getCustomer(); - RequestContext requestContext = gBBInput.getRequestContext(); - CloudRegion cloudRegion = gBBInput.getCloudRegion(); - String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc"); - cloudRegion.setLcpCloudRegionId(cloudRegionSdnc); try { - String response = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - execution.setVariable("SDNCUnAssignNetworkResponse", response); - execution.setVariable("isRollbackNeeded", true); + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc"); + cloudRegion.setLcpCloudRegionId(cloudRegionSdnc); + GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.NETWORK); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index e9dcdade9f..10ee13ebed 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -27,7 +27,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -50,6 +49,9 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; @@ -62,6 +64,7 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; @@ -72,6 +75,7 @@ import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; @@ -118,6 +122,12 @@ public class WorkflowAction { private CatalogDbClient catalogDbClient; @Autowired private AAIConfigurationResources aaiConfigurationResources; + @Autowired + private WorkflowActionExtractResourcesAAI workflowActionUtils; + + @Autowired + private Environment environment; + private String defaultCloudOwner = "org.onap.so.cloud-owner"; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -135,6 +145,7 @@ public class WorkflowAction { final String apiVersion = (String) execution.getVariable(G_APIVERSION); final String uri = (String) execution.getVariable(G_URI); final String vnfType = (String) execution.getVariable(VNF_TYPE); + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); @@ -149,6 +160,19 @@ public class WorkflowAction { execution.setVariable(G_ISTOPLEVELFLOW, true); ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); RequestDetails requestDetails = sIRequest.getRequestDetails(); + String cloudOwner = ""; + try{ + cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner(); + } catch (Exception ex) { + cloudOwner = environment.getProperty(defaultCloudOwner); + } + boolean suppressRollback = false; + try{ + suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); + } catch (Exception ex) { + suppressRollback = false; + } + execution.setVariable("suppressRollback", suppressRollback); Resource resource = extractResourceIdAndTypeFromUri(uri); WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); @@ -160,12 +184,15 @@ public class WorkflowAction { } else { resourceId = resource.getResourceId(); } + if((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE){ + serviceInstanceId = resourceId; + } execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { - orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner); } orchFlows = filterOrchFlows(orchFlows, resourceType, execution); String key = ""; @@ -238,10 +265,11 @@ public class WorkflowAction { } else if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase("deactivateInstance")) { resourceCounter.add(new Resource(WorkflowType.SERVICE,"",false)); + } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance") || (requestAction.equalsIgnoreCase("recreateInstance")))) { + traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds); } else { buildAndThrowException(execution, "Current Macro Request is not supported"); } - String foundObjects = ""; for(WorkflowType type : WorkflowType.values()){ foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; @@ -249,7 +277,7 @@ public class WorkflowAction { logger.info("Found {}", foundObjects); if (orchFlows == null || orchFlows.isEmpty()) { - orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner); } flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId, resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails); @@ -265,9 +293,9 @@ public class WorkflowAction { execution.setVariable("calledHoming", false); } if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))){ - generateResourceIds(flowsToExecute, resourceCounter); + generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId); }else{ - updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds); + updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds, serviceInstanceId); } } @@ -318,7 +346,7 @@ public class WorkflowAction { } private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, - List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) { + List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) { for(Pair<WorkflowType,String> pair : aaiResourceIds){ logger.debug(pair.getValue0() + ", " + pair.getValue1()); } @@ -326,7 +354,7 @@ public class WorkflowAction { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ - updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null); + updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null, serviceInstanceId); } }); } @@ -342,17 +370,18 @@ public class WorkflowAction { } return id; } - private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter) { + private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, String serviceInstanceId) { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) .collect(Collectors.toList()).get(i); - updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); } + updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey(),serviceInstanceId); + } }); } - protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){ + protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey, String serviceInstanceId){ String resourceId = id; if(resourceId==null){ resourceId = UUID.randomUUID().toString(); @@ -360,6 +389,7 @@ public class WorkflowAction { for(ExecuteBuildingBlock ebb : flowsToExecute){ if(key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())){ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); if(resource == WorkflowType.VNF){ workflowResourceIds.setVnfId(resourceId); }else if(resource == WorkflowType.VFMODULE){ @@ -378,6 +408,7 @@ public class WorkflowAction { if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink() && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); workflowResourceIds.setNetworkId(resourceId); ebb.setWorkflowResourceIds(workflowResourceIds); } @@ -539,6 +570,67 @@ public class WorkflowAction { } } + private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId, String vnfId, + List<Pair<WorkflowType, String>> aaiResourceIds) { + try{ + ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup + .getExistingServiceInstance(serviceInstanceAAI); + resourceCounter.add(new Resource(WorkflowType.SERVICE,serviceInstanceMSO.getServiceInstanceId(),false)); + if (serviceInstanceMSO.getVnfs() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO + .getVnfs()) { + if(vnf.getVnfId().equals(vnfId)){ + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId())); + resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getVnfId(),false)); + if (vnf.getVfModules() != null) { + for (VfModule vfModule : vnf.getVfModules()) { + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); + resourceCounter.add(new Resource(WorkflowType.VFMODULE,vfModule.getVfModuleId(),false)); + findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceCounter, aaiResourceIds); + } + } + if (vnf.getVolumeGroups() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf + .getVolumeGroups()) { + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); + resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,volumeGroup.getVolumeGroupId(),false)); + } + } + break; + } + } + } + } catch (Exception ex) { + buildAndThrowException(execution, + "Could not find existing Vnf or related Instances to execute the request on."); + } + } + + private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, List<Resource> resourceCounter, + List<Pair<WorkflowType, String>> aaiResourceIds) { + try{ + org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId); + AAIResultWrapper vfModuleWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule)); + Optional<Relationships> relationshipsOp; + relationshipsOp = vfModuleWrapper.getRelationships(); + if(relationshipsOp.isPresent()) { + relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get()); + if(relationshipsOp.isPresent()){ + Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get()); + if(config.isPresent()){ + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.get().getConfigurationId())); + resourceCounter.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false)); + } + } + } + }catch (Exception ex){ + buildAndThrowException(execution, + "Failed to find Configuration object from the vfModule."); + } + } + protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter, ServiceInstancesRequest sIRequest, String requestAction) throws IOException { @@ -943,10 +1035,10 @@ public class WorkflowAction { } protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction, - WorkflowType resourceName, boolean aLaCarte) { + WorkflowType resourceName, boolean aLaCarte, String cloudOwner) { List<OrchestrationFlow> listToExecute = new ArrayList<>(); NorthBoundRequest northBoundRequest = catalogDbClient - .getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(requestAction, resourceName.toString(), aLaCarte); + .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(requestAction, resourceName.toString(), aLaCarte, cloudOwner); if(northBoundRequest == null){ if(aLaCarte){ buildAndThrowException(execution,"The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API."); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java new file mode 100644 index 0000000000..ac06818e66 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -0,0 +1,116 @@ +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowActionBBFailure { + + private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class); + @Autowired + private RequestsDbClient requestDbclient; + @Autowired + private WorkflowAction workflowAction; + + protected void updateRequestErrorStatusMessage(DelegateExecution execution) { + try { + String requestId = (String) execution.getVariable("mso-request-id"); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + String errorMsg = ""; + Optional<String> errorMsgOp = retrieveErrorMessage(execution); + if(errorMsgOp.isPresent()){ + errorMsg = errorMsgOp.get(); + }else{ + errorMsg = "Failed to determine error message"; + } + request.setStatusMessage(errorMsg); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e); + } + } + + public void updateRequestStatusToFailed(DelegateExecution execution) { + try { + String requestId = (String) execution.getVariable("mso-request-id"); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + String rollbackErrorMsg = ""; + String errorMsg = ""; + Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete"); + Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback"); + + if(rollbackCompletedSuccessfully==null) + rollbackCompletedSuccessfully = false; + + if(isRollbackFailure==null) + isRollbackFailure = false; + + if(rollbackCompletedSuccessfully){ + rollbackErrorMsg = "Rollback has been completed successfully."; + request.setRollbackStatusMessage(rollbackErrorMsg); + execution.setVariable("RollbackErrorMessage", rollbackErrorMsg); + }else if(isRollbackFailure){ + Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution); + if(rollbackErrorMsgOp.isPresent()){ + rollbackErrorMsg = rollbackErrorMsgOp.get(); + }else{ + rollbackErrorMsg = "Failed to determine rollback error message."; + } + request.setRollbackStatusMessage(rollbackErrorMsg); + execution.setVariable("RollbackErrorMessage", rollbackErrorMsg); + }else{ + Optional<String> errorMsgOp = retrieveErrorMessage(execution); + if(errorMsgOp.isPresent()){ + errorMsg = errorMsgOp.get(); + }else{ + errorMsg = "Failed to determine error message"; + } + request.setStatusMessage(errorMsg); + execution.setVariable("ErrorMessage", errorMsg); + } + request.setProgress(Long.valueOf(100)); + request.setRequestStatus("FAILED"); + request.setLastModifiedBy("CamundaBPMN"); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e); + } + } + + private Optional<String> retrieveErrorMessage (DelegateExecution execution){ + String errorMsg = ""; + try { + WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); + if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){ + errorMsg = exception.getErrorMessage(); + } + if(errorMsg == null || errorMsg.equals("")){ + errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); + } + return Optional.of(errorMsg); + } catch (Exception ex) { + logger.error("Failed to extract workflow exception from execution.",ex); + } + return Optional.empty(); + } + + public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) { + execution.setVariable("isRollbackComplete", true); + updateRequestStatusToFailed(execution); + } + + public void abortCallErrorHandling(DelegateExecution execution) { + String msg = "Flow has failed. Rainy day handler has decided to abort the process."; + logger.error(msg); + throw new BpmnError(msg); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 66e2694db6..917039b17b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -20,8 +20,11 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; +import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -57,6 +60,8 @@ public class WorkflowActionBBTasks { private RequestsDbClient requestDbclient; @Autowired private WorkflowAction workflowAction; + @Autowired + private WorkflowActionBBFailure workflowActionBBFailure; public void selectBB(DelegateExecution execution) { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution @@ -178,27 +183,30 @@ public class WorkflowActionBBTasks { } } - public void setupCompleteMsoProcess(DelegateExecution execution) { - final String requestId = (String) execution.getVariable(G_REQUEST_ID); - final String action = (String) execution.getVariable(G_ACTION); - final String resourceId = (String) execution.getVariable("resourceId"); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); - final String resourceName = (String) execution.getVariable("resourceName"); - final String source = (String) execution.getVariable("source"); - String macroAction = ""; - if (aLaCarte) { - macroAction = "ALaCarte-" + resourceName + "-" + action; - } else { - macroAction = "Macro-" + resourceName + "-" + action; + public void updateRequestStatusToComplete(DelegateExecution execution) { + try{ + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + final String action = (String) execution.getVariable(G_ACTION); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + final String resourceName = (String) execution.getVariable("resourceName"); + String macroAction = ""; + if (aLaCarte) { + macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + } else { + macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + } + execution.setVariable("finalStatusMessage", macroAction); + Timestamp endTime = new Timestamp(System.currentTimeMillis()); + request.setEndTime(endTime); + request.setStatusMessage(macroAction); + request.setProgress(Long.valueOf(100)); + request.setRequestStatus("COMPLETE"); + request.setLastModifiedBy("CamundaBPMN"); + requestDbclient.updateInfraActiveRequests(request); + }catch (Exception ex) { + workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex); } - String msoCompletionRequest = "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>" - + requestId + "</request-id><action>" + action + "</action><source>" + source - + "</source></request-info><status-message>" + macroAction - + " request was executed correctly.</status-message><serviceInstanceId>" + resourceId - + "</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"; - execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest); - execution.setVariable("mso-request-id", requestId); - execution.setVariable("mso-service-instance-id", resourceId); } public void checkRetryStatus(DelegateExecution execution) { @@ -206,11 +214,12 @@ public class WorkflowActionBBTasks { String requestId = (String) execution.getVariable(G_REQUEST_ID); String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); + int nextCount = retryCount +1; if (handlingCode.equals("Retry")){ - updateRequestErrorStatusMessage(execution); + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); try{ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retry " + retryCount+1 + "/5 will be started in " + retryDuration); + request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration); requestDbclient.updateInfraActiveRequests(request); } catch(Exception ex){ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex); @@ -218,7 +227,7 @@ public class WorkflowActionBBTasks { if(retryCount<5){ int currSequence = (int) execution.getVariable("gCurrentSequence"); execution.setVariable("gCurrentSequence", currSequence-1); - execution.setVariable(RETRY_COUNT, retryCount + 1); + execution.setVariable(RETRY_COUNT, nextCount); }else{ workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort"); } @@ -267,7 +276,7 @@ public class WorkflowActionBBTasks { } } - updateRequestErrorStatusMessage(execution); + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); if (rollbackFlows.isEmpty()) execution.setVariable("isRollbackNeeded", false); @@ -313,6 +322,7 @@ public class WorkflowActionBBTasks { String rollbackErrorMsg = null; boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete"); boolean isRollbackFailure = (boolean) execution.getVariable("isRollback"); + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); if(rollbackCompleted){ rollbackErrorMsg = "Rollback has been completed successfully."; @@ -335,6 +345,12 @@ public class WorkflowActionBBTasks { logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg); } } + if(ebb!=null && ebb.getBuildingBlock()!=null){ + String flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed."; + request.setFlowStatus(flowStatus); + execution.setVariable("flowStatus", flowStatus); + } + request.setProgress(Long.valueOf(100)); request.setRequestStatus("FAILED"); request.setLastModifiedBy("CamundaBPMN"); @@ -356,7 +372,7 @@ public class WorkflowActionBBTasks { logger.error("Failed to extract workflow exception from execution.",ex); } - if (errorMsg == null){ + if (errorMsg == null || errorMsg.equals("")){ try { errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); } catch (Exception ex) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java new file mode 100644 index 0000000000..81609d1ddd --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java @@ -0,0 +1,38 @@ +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.util.List; +import java.util.Optional; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowActionExtractResourcesAAI { + private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class); + + public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) { + List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION); + for(AAIResultWrapper configWrapper : configurations) { + Optional<Configuration> config = configWrapper.asBean(Configuration.class); + if(config.isPresent()){ + return config; + } + } + return Optional.empty(); + } + + public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) { + List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC); + for(AAIResultWrapper vnfcWrapper : vnfcs){ + if(vnfcWrapper.getRelationships().isPresent()){ + return vnfcWrapper.getRelationships(); + } + } + return Optional.empty(); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 57c760b01f..4abb0a1b2c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -49,9 +49,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.beans.Subnet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.util.UriUtils; @@ -59,6 +62,7 @@ import org.springframework.web.util.UriUtils; public class NetworkAdapterObjectMapper { private static final ModelMapper modelMapper = new ModelMapper(); private static String FORWARD_SLASH = "/"; + private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class); public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException { CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); @@ -82,8 +86,12 @@ public class NetworkAdapterObjectMapper { //build and set provider Vlan Network ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network); createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); - - createNetworkRequest.setNetworkTechnology(setNetworkTechnology(l3Network.getModelInfoNetwork().getNetworkTechnology())); + String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology(); + if(networkTechnology == null) { + networkTechnology = l3Network.getNetworkTechnology(); + logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology); + } + createNetworkRequest.setNetworkTechnology(setNetworkTechnology(networkTechnology)); //build and set Contrail Network ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java new file mode 100644 index 0000000000..f91ad44f2b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java @@ -0,0 +1,64 @@ +package org.onap.so.client.namingservice; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenDeleteResponse; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.namingservice.model.NameGenResponse; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + + + +@Component +public class NamingClient{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClient.class); + private static final String ENDPOINT = "mso.naming.endpoint"; + private static final String AUTH = "mso.naming.auth"; + + @Autowired + private RestTemplate restTemplate; + @Autowired + private Environment env; + @Autowired + private NamingClientResponseValidator namingClientResponseValidator; + + public String postNameGenRequest(NameGenRequest request) throws BadResponseException { + String targetUrl = env.getProperty(ENDPOINT); + HttpHeaders headers = setHeaders(env.getProperty(AUTH)); + msoLogger.info("Sending postNameGenRequest to url: " + targetUrl); + HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers); + ResponseEntity<NameGenResponse> response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class); + return namingClientResponseValidator.validateNameGenResponse(response); + } + + public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException { + String targetUrl = env.getProperty(ENDPOINT); + HttpHeaders headers = setHeaders(env.getProperty(AUTH)); + msoLogger.info("Sending deleteNameGenRequest to url: " + targetUrl); + HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers); + ResponseEntity<NameGenDeleteResponse> response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class); + return namingClientResponseValidator.validateNameGenDeleteResponse(response); + } + + private HttpHeaders setHeaders(String auth) { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + List<MediaType> acceptableMediaTypes = new ArrayList<>(); + acceptableMediaTypes.add(MediaType.APPLICATION_JSON); + headers.setAccept(acceptableMediaTypes); + headers.add(HttpHeaders.AUTHORIZATION, auth); + return headers; + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java new file mode 100644 index 0000000000..ab0639574c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -0,0 +1,103 @@ +package org.onap.so.client.namingservice; + +import java.util.List; + +import org.apache.http.HttpStatus; +import org.onap.namingservice.model.NameGenDeleteResponse; +import org.onap.namingservice.model.NameGenResponse; +import org.onap.namingservice.model.NameGenResponseError; +import org.onap.namingservice.model.Respelement; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; + +@Component +public class NamingClientResponseValidator { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClientResponseValidator.class); + private static final String INSTANCE_GROUP_NAME = "instance-group-name"; + private static final String NO_RESPONSE_FROM_NAMING_SERVICE = "Error did not receive a response from Naming Service."; + private static final String NULL_RESPONSE_FROM_NAMING_SERVICE = "Error received a null response from Naming Service."; + private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s"; + + public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { + if (response == null) { + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE); + throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); + } + + int responseCode = response.getStatusCodeValue(); + String generatedName = ""; + NameGenResponse responseBody = response.getBody(); + if (responseBody == null) { + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE); + throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); + } + + if (isHttpCodeSuccess(responseCode)) { + msoLogger.info("Successful Response from Naming Service"); + List<Respelement> respList = responseBody.getElements(); + + if (respList != null) { + for (int i=0; i < respList.size(); i++) { + Respelement respElement = respList.get(i); + if (respElement != null) { + String resourceName = respElement.getResourceName(); + if (INSTANCE_GROUP_NAME.equals(resourceName)) { + generatedName = respElement.getResourceValue(); + break; + } + } + } + } + return generatedName; + } else { + NameGenResponseError error = responseBody.getError(); + String errorMessageString = NAMING_SERVICE_ERROR; + if (error != null) { + errorMessageString = error.getMessage(); + } + String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, errorMessage); + throw new BadResponseException(errorMessage); + } + } + + public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { + if (response == null) { + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE); + throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); + } + + int responseCode = response.getStatusCodeValue(); + String responseMessage = ""; + NameGenDeleteResponse responseBody = response.getBody(); + if (responseBody == null) { + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE); + throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); + } + + if (isHttpCodeSuccess(responseCode)) { + msoLogger.info("Successful Response from Naming Service"); + return responseMessage; + } else { + String errorMessageString = NAMING_SERVICE_ERROR; + + String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, errorMessage); + throw new BadResponseException(errorMessage); + } + } + + private boolean isHttpCodeSuccess(int code) { + return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java new file mode 100644 index 0000000000..c3f216e288 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java @@ -0,0 +1,38 @@ +package org.onap.so.client.namingservice; + +import java.util.List; + +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenRequest; +import org.springframework.stereotype.Component; + +@Component +public class NamingRequestObjectBuilder{ + + public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){ + Element element = new Element(); + element.setExternalKey(instanceGroupId); + element.setPolicyInstanceName(policyInstanceName); + element.setNamingType(namingType); + element.setResourceName(instanceGroupName); + element.setNamingIngredientsZeroOrMore(nfNamingCode); + return element; + } + public Deleteelement deleteElementMapper(String instanceGroupId){ + Deleteelement deleteElement = new Deleteelement(); + deleteElement.setExternalKey(instanceGroupId); + return deleteElement; + } + public NameGenRequest nameGenRequestMapper(List<Element> elements){ + NameGenRequest nameGenRequest = new NameGenRequest(); + nameGenRequest.setElements(elements); + return nameGenRequest; + } + public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){ + NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest(); + nameGenDeleteRequest.setElements(deleteElements); + return nameGenDeleteRequest; + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index e13a765cf2..a96f01c3d0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,10 +38,10 @@ import org.springframework.stereotype.Component; public class AAIConfigurationResources { @Autowired private InjectionHelper injectionHelper; - + @Autowired private AAIObjectMapper aaiObjectMapper; - + /** * A&AI call to create configuration * @@ -142,24 +142,32 @@ public class AAIConfigurationResources { * * @param configurationId * @param vpnId + * */ public void connectConfigurationToVpnBinding(String configurationId, String vpnId) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI); } - + public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI); } - + public void connectConfigurationToVnfc(String configurationId, String vnfcName){ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); injectionHelper.getAaiClient().connect(configurationURI, vnfcURI); } + + public void connectConfigurationToL3Network(String configurationId, String networkId){ + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId); + injectionHelper.getAaiClient().connect(configurationURI, networkURI); + } + /** * method to delete Configuration details in A&AI * @@ -188,7 +196,7 @@ public class AAIConfigurationResources { return injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); } - + public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); configuration.setOrchestrationStatus(orchestrationStatus); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index a4c705b0c7..16d5e8e1db 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,22 +47,22 @@ import org.springframework.stereotype.Component; public class AAINetworkResources { @Autowired private InjectionHelper injectionHelper; - + @Autowired private AAIObjectMapper aaiObjectMapper; - + public void updateNetwork(L3Network network) { AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); injectionHelper.getAaiClient().update(networkURI, aaiL3Network); } - + public void updateSubnet(L3Network network, Subnet subnet) { AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId()); org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet); injectionHelper.getAaiClient().update(subnetURI, aaiSubnet); } - + public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) { AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); @@ -76,11 +76,11 @@ public class AAINetworkResources { AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); injectionHelper.getAaiClient().delete(networkURI); } - + public Optional<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) { - return injectionHelper.getAaiClient().get(netBindingUri).asBean(VpnBinding.class); + return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class); } - + public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) { return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class); } @@ -88,85 +88,85 @@ public class AAINetworkResources { public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) { return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class); } - + public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL); AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri); return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); - } - + } + public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL); return injectionHelper.getAaiClient().get(uri); } - + public void createNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup); } - + public void createNetworkCollection(Collection networkCollection) { AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection); injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); } - + public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); injectionHelper.getAaiClient().connect(tenantURI, networkURI); } - + public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); - injectionHelper.getAaiClient().connect(cloudRegionURI, networkURI); + injectionHelper.getAaiClient().connect(networkURI,cloudRegionURI); } - + public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) { AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI); } - + public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI); } - + public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) { AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI); } - + public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES); } - + public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri); } - + public void deleteCollection(Collection collection) { AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); injectionHelper.getAaiClient().delete(collectionURI); } - + public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); injectionHelper.getAaiClient().delete(instanceGroupURI); } - + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index 19025b4b9f..a9a52bd115 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -110,4 +110,18 @@ public class AAIVnfResources { .orElse(new org.onap.aai.domain.yang.GenericVnf()); return vnf.isInMaint(); } + + public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) { + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().connect(vnfURI,cloudRegionURI); + } + + public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) { + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().connect(tenantURI, vnfURI); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java new file mode 100644 index 0000000000..8b443a165b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java @@ -0,0 +1,60 @@ +/*- + * ============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.onap.so.client.orchestration; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.Deleteelement; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.namingservice.NamingClient; +import org.onap.so.client.namingservice.NamingRequestObjectBuilder; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NamingServiceResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingServiceResources.class); + private static final String NAMING_TYPE = "instanceGroup"; + + @Autowired + private NamingClient namingClient; + + @Autowired + private NamingRequestObjectBuilder namingRequestObjectBuilder; + + public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException { + Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName()); + List<Element> elements = new ArrayList<Element>(); + elements.add(element); + return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements))); + } + + public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException { + Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId()); + List<Deleteelement> deleteElements = new ArrayList<Deleteelement>(); + deleteElements.add(deleteElement); + return(namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements))); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java index d3589db101..8b53c28547 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java @@ -20,92 +20,81 @@ package org.onap.so.client.orchestration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; - @Component public class SDNCNetworkResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCNetworkResources.class); - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + SDNCNetworkResources.class); + @Autowired private NetworkTopologyOperationRequestMapper sdncRM; - - @Autowired - private SDNCClient sdncClient; - public String assignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - - public String rollbackAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + + public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - public String activateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.ACTIVATE, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - - public String deactivateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) throws MapperException, BadResponseException { - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + + public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - public String deleteNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - - public String changeAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + + public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - public String unassignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext, CloudRegion cloudRegion) - throws MapperException, BadResponseException { - - GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - return sdncClient.post(sdncReq, SDNCTopology.NETWORK); - } - + public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network, + ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, + CloudRegion cloudRegion) { + return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java index ad9e201862..a4c9b8fe05 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java @@ -20,37 +20,28 @@ package org.onap.so.client.orchestration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; - @Component public class SDNCServiceInstanceResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - SDNCServiceInstanceResources.class); - @Autowired private ServiceTopologyOperationMapper sdncRM; - - @Autowired - private SDNCClient sdncClient; - + /** - * SDNC call to perform Service Topology Assign for ServiceInsatnce + * SDNC call to perform Service Topology Assign for ServiceInsatnce + * * @param serviceInstance * @param customer * @param requestContext @@ -58,16 +49,16 @@ public class SDNCServiceInstanceResources { * @throws BadResponseException * @return the response as a String */ - public String assignServiceInstance(ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( - SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + public GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext); - return sdncClient.post(sdncReq, SDNCTopology.SERVICE); } /** - * SDNC call to perform Service Topology Delete for ServiceInsatnce + * SDNC call to perform Service Topology Delete for ServiceInsatnce + * * @param serviceInstance * @param customer * @param requestContext @@ -75,24 +66,23 @@ public class SDNCServiceInstanceResources { * @throws BadResponseException * @return the response as a String */ - public String deleteServiceInstance(ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( - SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + public GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, + GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, requestContext); - return sdncClient.post(sdncReq, SDNCTopology.SERVICE); } - - public String unassignServiceInstance(ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( - SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + + public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, + GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, requestContext); - return sdncClient.post(sdncReq, SDNCTopology.SERVICE); } - + /** * SDNC call to perform Service Topology Deactivate for ServiceInstance + * * @param serviceInstance * @param customer * @param requestContext @@ -100,16 +90,17 @@ public class SDNCServiceInstanceResources { * @throws BadResponseException * @return the response as a String */ - public String deactivateServiceInstance(ServiceInstance serviceInstance, Customer customer, - RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( - SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + public GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, + GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, requestContext); - return sdncClient.post(sdncReq, SDNCTopology.SERVICE); } - + /** - * SDNC call to perform Service Topology Change Assign for the ServiceInstance + * SDNC call to perform Service Topology Change Assign for the + * ServiceInstance + * * @param serviceInstance * @param customer * @param requestContext @@ -117,8 +108,10 @@ public class SDNCServiceInstanceResources { * @throws BadResponseException * @return the response as a String */ - public String changeModelServiceInstance(ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext); - return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + public GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + requestContext); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java index 3c192e1b1c..e7f0a40d2a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -33,7 +33,6 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -41,59 +40,51 @@ import org.springframework.stereotype.Component; @Component public class SDNCVfModuleResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVfModuleResources.class); - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + SDNCVfModuleResources.class); + @Autowired private VfModuleTopologyOperationRequestMapper sdncRM; - + @Autowired private SDNCClient sdncClient; - - public String assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - - GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); - return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); - } - public String unassignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance) - throws MapperException, BadResponseException { - - GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null); - return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup, + GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, + RequestContext requestContext) throws MapperException { + return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, + volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); } - public String deactivateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { + public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf, + ServiceInstance serviceInstance) throws MapperException { + return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, + vnf, serviceInstance, null, null, null, null); + } - GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper( - SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, - customer, cloudRegion, requestContext, null); - return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf, + ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException { + return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); } - - public String queryVfModule(VfModule vfModule) - throws MapperException, BadResponseException { - - String objectPath = vfModule.getSelflink(); + + public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException { + String objectPath = vfModule.getSelflink(); return sdncClient.get(objectPath); } - - public String activateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - - GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); - return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + + public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf, + ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException { + return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); } - - public String changeAssignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) throws MapperException, BadResponseException { - GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); - return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + + public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf, + ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException { + return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, + null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index b30fc932c0..e5194e3e37 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -32,7 +32,6 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -49,52 +48,41 @@ public class SDNCVnfResources { private SDNCClient sdncClient; public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext, boolean homing) - throws MapperException, BadResponseException { + CloudRegion cloudRegion, RequestContext requestContext, boolean homing) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing); } - public String activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } - public String deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } - public String unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } - public String deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } - public String changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, - CloudRegion cloudRegion, RequestContext requestContext) - throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) { + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index 37e13fb8d8..13ba107576 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -105,12 +105,20 @@ public class SdnCommonTasks { responseCode = (String) embeddedResponse.get(RESPONSE_CODE); responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE); } - + ObjectMapper objMapper = new ObjectMapper(); + String jsonResponse; + try { + jsonResponse = objMapper.writeValueAsString(output); + msoLogger.debug(jsonResponse); + } catch (JsonProcessingException e) { + msoLogger.warnSimple("Could not convert SDNC Response to String", e); + jsonResponse = ""; + } msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage); int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0; if (isHttpCodeSuccess(code)) { msoLogger.info("Successful Response from SDNC"); - return responseMessage; + return jsonResponse; } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index bf128a4838..e860d3cc48 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -123,7 +123,7 @@ public class VnfTopologyOperationRequestMapper { List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>(); for (InstanceGroup instanceGroup : instanceGroups) { - if (ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP + if (ModelInfoInstanceGroup.TYPE_L3_NETWORK .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds(); instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId()); diff --git a/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json new file mode 100644 index 0000000000..b86ffbc6b0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json @@ -0,0 +1,325 @@ +{ + "swagger": "2.0", + "info": { + "version": "2018.08.01", + "title": "networkelementnamegenprodtest Service" + }, + "basePath": "/web", + "paths": { + "/service/v1/addPolicy": { + "post": { + "summary": "Respond Hello <name>!", + "description": "Returns a JSON object with a string to say hello. Uses 'world' if a name is not specified", + "operationId": "addPolicyToDB", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + }, + "404": { + "description": "Service not available" + }, + "500": { + "description": "Unexpected Runtime error" + } + } + } + }, + "/service/v1/genNetworkElementName": { + "post": { + "summary": "Generates name", + "description": "Generates network element name based on a naming policy1 ", + "operationId": "generateNetworkElementName", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/NameGenRequest" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/NameGenResponse" + } + }, + "404": { + "description": "Service not available" + }, + "500": { + "description": "Unexpected Runtime error" + } + } + }, + "delete": { + "summary": "Release an existing name by external key", + "description": "Release network element name ", + "operationId": "releaseNetworkElementName", + "produces": [ + "application/json" + ],"parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/NameGenDeleteRequest" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/NameGenDeleteResponse" + } + }, + "404": { + "description": "Service not available" + }, + "500": { + "description": "Unexpected Runtime error" + } + } + } + }, + "/service/v1/getpolicyresponse/{policyName}": { + "get": { + "summary": "Respond Hello <name>!", + "description": "Returns a JSON object with a string to say hello. Uses 'world' if a name is not specified", + "operationId": "getPolicyResponse", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + }, + "404": { + "description": "Service not available" + }, + "500": { + "description": "Unexpected Runtime error" + } + } + } + } + }, + "definitions": { + "HelloWorld": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "NameGenRequest": { + "title": "NameGenRequest", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "elements" + ], + "properties": { + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/element" + } + } + }, + "additionalProperties": false, + "definitions": { + "element": { + "type": "object", + "required": [ + "resource-name", + "external-key", + "policy-instance-name", + "naming-type" + ], + "properties": { + "resource-name": { + "type": "string", + "description": "Name of the resource" + }, + "resource-value": { + "type": "string", + "description": "Optional. If given, request will be considered as update request" + }, + "external-key": { + "type": "string", + "description": "Key identifier for generated name. This will be used in release/update request" + }, + "policy-instance-name": { + "type": "string", + "description": "Name of the policy to be used for name generation" + }, + "naming-type": { + "type": "string", + "description": "Naming type of the resource" + } + }, + "additionalProperties": { + "type": "string" + } + } + } + }, + "NameGenResponse": { + "type": "object", + "description":"Response with generated names for each naming type. Either elements(one or more) or an error block will be present", + "properties": { + "elements" : { + "type":"array", + "items": { "$ref": "#/definitions/respelement" } + }, + "error" : { + "type":"object", + "required": ["errorId", "message"], + "properties":{ + "errorId":{"type":"string" , "description":"error code"}, + "message": {"type":"string", "description":"error message"} + } + } + } + }, + "element": { + "type": "object", + "required": [ + "resource-name", + "external-key", + "policy-instance-name", + "naming-type" + ], + "properties": { + "resource-name": { + "type": "string", + "description": "Name of the resource" + }, + "resource-value": { + "type": "string", + "description": "Optional. If given, request will be considered as update request" + }, + "external-key": { + "type": "string", + "description": "Key identifier for generated name. This will be used in release/update request" + }, + "policy-instance-name": { + "type": "string", + "description": "Name of the policy to be used for name generation" + }, + "naming-type": { + "type": "string", + "description": "Naming type of the resource" + }, + "${naming-ingredients(zero or more)}": { + "type": "string", + "description": "values to subsitute in the naming recipe" + } + }, + "additionalProperties": { + "type": "string" + } + }, + "respelement": { + "type":"object", + "required": [ "resource-name","resource-value","external-key"], + "properties": { + "resource-value": { + "type": "string", + "description": "Optional. If given, request will be considered as update request" + }, + "resource-name": { + "type": "string", + "description": "Name of the resource" + }, + "external-key": { + "type": "string", + "description": "Key identifier for generated name. This will be used in release/update request" + } + } + }, + "NameGenDeleteRequest": { + "title": "NameGenRequest", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "elements" + ], + "properties": { + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/deleteelement" + } + } + } + }, + "deleteelement": { + "type": "object", + "required": [ "external-key" ], + "properties": { + "external-key": { + "type": "string", + "description": "External key of the name that is being released" + } + } + },"NameGenDeleteResponse": { + "title": "NameGenRequest", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "elements" + ], + "properties": { + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/deleteresponseelement" + } + } + } + }, + "deleteresponseelement": { + "type": "object", + "required": [ "resource-value","resource_name","external-key" ], + "properties": { + "resource-value": { + "type": "string", + "description": "Name that is being release" + }, + "resource-name": { + "type": "string", + "description": "Resource Name" + }, + "external-key": { + "type": "string", + "description": "External key of the name that is being released" + } + } + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java index 95201d555d..7715de9672 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -21,12 +21,11 @@ package org.onap.so.bpmn; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.buildingblock.SniroHomingV2; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionExtractResourcesAAI; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; @@ -44,6 +43,7 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; +import org.onap.so.client.orchestration.NamingServiceResources; import org.onap.so.client.orchestration.NetworkAdapterResources; import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCServiceInstanceResources; @@ -51,13 +51,9 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; -import org.onap.so.client.sdnc.SDNCClient; -import org.onap.so.client.sniro.SniroClient; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.client.RequestsDbClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.core.env.Environment; @RunWith(MockitoJUnitRunner.Silent.class) public abstract class BaseTaskTest extends TestDataSetup { @@ -111,6 +107,9 @@ public abstract class BaseTaskTest extends TestDataSetup { @Mock protected AAIInstanceGroupResources aaiInstanceGroupResources; + + @Mock + protected NamingServiceResources namingServiceResources; @Mock protected ApplicationControllerAction appCClient; @@ -145,5 +144,9 @@ public abstract class BaseTaskTest extends TestDataSetup { @Mock protected ExceptionBuilder exceptionUtil; - + @Mock + protected WorkflowActionExtractResourcesAAI workflowActionUtils; + + @Mock + protected Environment env; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index 44b56662ba..da7e727488 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -417,4 +417,32 @@ public class AAICreateTasksTest extends BaseTaskTest{ aaiCreateTasks.createConfiguration(execution); verify(aaiConfigurationResources, times(1)).createConfiguration(configuration); } + + @Test + public void connectVnfToCloudRegionTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + aaiCreateTasks.connectVnfToCloudRegion(execution); + verify(aaiVnfResources, times(1)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + } + + @Test + public void connectNoneToVnfToCloudRegionTest() throws Exception { + String[] arr = new String[1]; + arr[0] = "test25Region2"; + doReturn(arr).when(env).getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class); + gBBInput = execution.getGeneralBuildingBlock(); + gBBInput.getCloudRegion().setLcpCloudRegionId("test25Region2"); + doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + aaiCreateTasks.connectVnfToCloudRegion(execution); + verify(aaiVnfResources, times(0)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); + } + + @Test + public void connectVnfTenantTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiVnfResources).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion()); + aaiCreateTasks.connectVnfToTenant(execution); + verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion()); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 6c20938780..f97b137fb3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -292,6 +293,17 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ } @Test + public void updateHeatStackIdVfModuleToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); + + aaiUpdateTasks.updateHeatStackIdVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); + assertEquals(vfModule.getHeatStackId(), ""); + } + + @Test public void updateHeatStackIdVfModuleExceptionTest() throws Exception { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); @@ -358,6 +370,16 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); assertEquals("newHeatStackId", volumeGroup.getHeatStackId()); } + @Test + public void updateHeatStackIdVolumeGroupToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + + aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + assertEquals(volumeGroup.getHeatStackId(), ""); + } @Test public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java index 756fe5120d..4ad6fba910 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -67,7 +67,7 @@ public class AssignVnfTest extends BaseTaskTest { modelVnfc.setFunction("function"); ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup(); - modelNetworkInstanceGroup.setType("networkInstanceGroup"); + modelNetworkInstanceGroup.setType("L3-NETWORK"); modelNetworkInstanceGroup.setFunction("function"); instanceGroup1 = new InstanceGroup(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java new file mode 100644 index 0000000000..41739f37e6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java @@ -0,0 +1,82 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.namingservice.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class NamingServiceCreateTasksTest extends BaseTaskTest { + @InjectMocks + private NamingServiceCreateTasks namingServiceCreateTasks = new NamingServiceCreateTasks(); + + private InstanceGroup instanceGroup; + + @Before + public void before() throws BBObjectNotFoundException { + instanceGroup = setInstanceGroup(); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + } + + @Test + public void createInstanceGroupTest() throws Exception { + String policyInstanceName = "policyInstanceName"; + String nfNamingCode = "nfNamingCode"; + String generatedName = "generatedInstanceGroupName"; + execution.setVariable(policyInstanceName, policyInstanceName); + execution.setVariable(nfNamingCode, nfNamingCode); + doReturn(generatedName).when(namingServiceResources).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode); + + namingServiceCreateTasks.createInstanceGroupName(execution); + verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode); + assertEquals(instanceGroup.getInstanceGroupName(), generatedName); + } + + @Test + public void createInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BBObjectNotFoundException.class); + lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound"); + doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound")); + String policyInstanceName = "policyInstanceName"; + String nfNamingCode = "nfNamingCode"; + execution.setVariable(policyInstanceName, policyInstanceName); + execution.setVariable(nfNamingCode, nfNamingCode); + doReturn("").when(namingServiceResources).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode); + namingServiceCreateTasks.createInstanceGroupName(execution); + verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java new file mode 100644 index 0000000000..97dcc617ac --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java @@ -0,0 +1,71 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.namingservice.tasks; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class NamingServiceDeleteTasksTest extends BaseTaskTest { + @InjectMocks + private NamingServiceDeleteTasks namingServiceDeleteTasks = new NamingServiceDeleteTasks(); + + private InstanceGroup instanceGroup; + + @Before + public void before() throws BBObjectNotFoundException { + instanceGroup = setInstanceGroup(); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + + doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup); + + namingServiceDeleteTasks.deleteInstanceGroupName(execution); + verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup); + } + + @Test + public void deleteInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BBObjectNotFoundException.class); + lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound"); + doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound")); + doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup); + namingServiceDeleteTasks.deleteInstanceGroupName(execution); + verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java index a556346252..65e7d249c5 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; @@ -34,6 +35,9 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -45,8 +49,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; - +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; public class SDNCActivateTaskTest extends BaseTaskTest{ @@ -83,47 +87,48 @@ public class SDNCActivateTaskTest extends BaseTaskTest{ @Test public void activateVnfTest() throws Exception { - doReturn("success").when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext); sdncActivateTasks.activateVnf(execution); verify(sdncVnfResources, times(1)).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); } @Test public void activateVnfTestException() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); sdncActivateTasks.activateVnf(execution); } @Test public void activateNetworkTest() throws Exception { - doReturn("response").when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); sdncActivateTasks.activateNetwork(execution); verify(sdncNetworkResources, times(1)).activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology()); } @Test public void activateNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); sdncActivateTasks.activateNetwork(execution); } @Test public void activateVfModuleTest() throws Exception { - doReturn("success").when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncActivateTasks.activateVfModule(execution); - verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology()); } @Test public void activateVfModuleTestException() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncActivateTasks.activateVfModule(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index 24ae88b98c..d021df56e0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -35,6 +34,9 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -87,30 +89,25 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ @Test public void assignServiceInstanceTest() throws Exception { - doReturn("response").when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); - + doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); sdncAssignTasks.assignServiceInstance(execution); - verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext); - assertTrue(execution.getVariable("SDNCResponse").equals("response")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology()); } @Test public void assignServiceInstanceExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); - sdncAssignTasks.assignServiceInstance(execution); } @Test public void assignVnfTest() throws Exception { doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - execution.setVariable("generalBuildingBlock", gBBInput); sdncAssignTasks.assignVnf(execution); - verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); @@ -119,46 +116,39 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ @Test public void assignVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - sdncAssignTasks.assignVnf(execution); } @Test public void assignVfModuleTest() throws Exception { - doReturn("response").when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncAssignTasks.assignVfModule(execution); - verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - assertTrue(execution.getVariable("SDNCAssignResponse_" + vfModule.getVfModuleId()).equals("response")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology()); } @Test public void assignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - sdncAssignTasks.assignVfModule(execution); } @Test public void assignNetworkTest() throws Exception { - doReturn("response").when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); sdncAssignTasks.assignNetwork(execution); - verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology()); } @Test public void assignNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - sdncAssignTasks.assignNetwork(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java index 99c680d8bb..f01596c86f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -34,6 +33,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -44,7 +45,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; public class SDNCChangeAssignTasksTest extends BaseTaskTest{ @InjectMocks @@ -74,15 +76,11 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest{ @Test public void changeModelVnfTest() throws Exception { - String response = "sdncChangeModelServiceInstance"; - - doReturn(response).when(sdncServiceInstanceResources).changeModelServiceInstance(serviceInstance, customer, requestContext); - - sdncChangeAssignTasks.changeModelServiceInstance(execution); - - verify(sdncServiceInstanceResources, times(1)).changeModelServiceInstance(serviceInstance, customer, requestContext); - - assertEquals(response, execution.getVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response")); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncChangeAssignTasks.changeModelVnf(execution); + verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); } @Test @@ -94,13 +92,11 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest{ @Test public void changeAssignModelVfModuleTest() throws Exception { - String response = "response"; - doReturn(response).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncChangeAssignTasks.changeAssignModelVfModule(execution); - verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - assertTrue(execution.getVariable("SDNCChangeAssignVfModuleResponse").equals(response)); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java index 66b8ecfb20..3d25addb9c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -21,9 +21,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -37,6 +34,10 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -48,7 +49,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; public class SDNCDeactivateTaskTest extends BaseTaskTest { @InjectMocks @@ -82,29 +84,27 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void deactivateVfModuleTest() throws Exception { - doReturn("success").when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncDeactivateTasks.deactivateVfModule(execution); - verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology()); } @Test public void deactivateVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); - sdncDeactivateTasks.deactivateVfModule(execution); } @Test public void deactivateVnfTest() throws Exception { - doReturn("success").when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncDeactivateTasks.deactivateVnf(execution); - verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); } @Test @@ -116,13 +116,11 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void deactivateServiceInstanceTest() throws Exception { - doReturn("response").when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); - + doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); sdncDeactivateTasks.deactivateServiceInstance(execution); - verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer, requestContext); - assertEquals("response", execution.getVariable("deactivateServiceInstanceSDNCResponse")); - assertTrue(execution.getVariable("sdncServiceInstanceRollback")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology()); } @Test @@ -134,34 +132,18 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void test_deactivateNetwork() throws Exception { - String expectedResponse = "return"; - - doReturn(expectedResponse).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); sdncDeactivateTasks.deactivateNetwork(execution); - verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - assertEquals(expectedResponse, execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); - - assertTrue(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology()); } @Test public void test_deactivateNetwork_exception() throws Exception { expectedException.expect(BpmnError.class); - - try { - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any()); - - sdncDeactivateTasks.deactivateNetwork(execution); - } finally { - verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - assertNull(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); - - assertFalse(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); - } + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any()); + sdncDeactivateTasks.deactivateNetwork(execution); + verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); } - } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index a6efbd5989..f1779cf119 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -129,15 +129,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks{ sndcRequestTasks.handleTimeOutException(delegateExecution); } - - @Test - public void HandleSyncError_Test() throws MapperException, BadResponseException{ - delegateExecution.setVariable("SDNCSyncError", "Error in SDNC Request"); - doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution); - expectedException.expect(BpmnError.class); - sndcRequestTasks.handleSyncError(delegateExecution); - } - @Test public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{ final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_ASYNC_Request.json"))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java index da8ea8f58c..1301787dff 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -37,6 +36,10 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -48,8 +51,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; public class SDNCUnassignTasksTest extends BaseTaskTest{ @InjectMocks @@ -81,101 +84,50 @@ public class SDNCUnassignTasksTest extends BaseTaskTest{ @Test public void unassignServiceInstanceTest() throws Exception { - doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); - + doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); sdncUnassignTasks.unassignServiceInstance(execution); - verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer, requestContext); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology()); } - @Test - public void unassignServiceInstanceTest_inventoried() throws Exception { - doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); - - serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - - sdncUnassignTasks.unassignServiceInstance(execution); - - verify(sdncServiceInstanceResources, times(0)).unassignServiceInstance(serviceInstance, customer, requestContext); - } + @Test public void unassignServiceInstanceExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); - sdncUnassignTasks.unassignServiceInstance(execution); } @Test public void unassignVfModuleTest() throws Exception { - doReturn("response").when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); - + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); sdncUnassignTasks.unassignVfModule(execution); - verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance); - assertEquals("response", execution.getVariable("SDNCResponse")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology()); } - @Test - public void unassignVfModuleTest_inventoried() throws Exception { - vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - - sdncUnassignTasks.unassignVfModule(execution); - verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); - assertNull(execution.getVariable("SDNCResponse")); - } - @Test - public void unassignVfModuleTest_pendingCreate() throws Exception { - vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_CREATE); - - sdncUnassignTasks.unassignVfModule(execution); - verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); - assertNull(execution.getVariable("SDNCResponse")); - } - @Test public void unassignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); - sdncUnassignTasks.unassignVfModule(execution); } @Test public void unassignVnfTest() throws Exception { - doReturn("response").when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncUnassignTasks.unassignVnf(execution); - verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - assertTrue(execution.getVariable("sdncUnassignVnfResponse").equals("response")); - } - - @Test - public void unassignVnfTest_inventoried() throws Exception { - genericVnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - - sdncUnassignTasks.unassignVnf(execution); - - verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - assertNull(execution.getVariable("sdncUnassignVnfResponse")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); } - @Test - public void unassignVnfTest_created() throws Exception { - genericVnf.setOrchestrationStatus(OrchestrationStatus.CREATED); - - sdncUnassignTasks.unassignVnf(execution); - - verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - assertNull(execution.getVariable("sdncUnassignVnfResponse")); - } @Test public void unassignVnfExceptionTest() throws Exception { @@ -187,28 +139,14 @@ public class SDNCUnassignTasksTest extends BaseTaskTest{ @Test public void unassignNetworkTest() throws Exception { String cloudRegionSdnc = "AAIAIC25"; - cloudRegion.setCloudRegionVersion("2.5"); - execution.setVariable("cloudRegionSdnc", cloudRegionSdnc); - - doReturn("response").when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); assertNotEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); sdncUnassignTasks.unassignNetwork(execution); - verify(sdncNetworkResources, times(1)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - assertEquals("response", execution.getVariable("SDNCUnAssignNetworkResponse")); assertEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); - } - - @Test - public void unassignNetworkTest_inventoried() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - - sdncUnassignTasks.unassignNetwork(execution); - - verify(sdncNetworkResources, times(0)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - assertNull(execution.getVariable("SDNCUnAssignNetworkResponse")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology()); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java new file mode 100644 index 0000000000..d9a7eeb8f7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java @@ -0,0 +1,126 @@ +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.db.request.beans.InfraActiveRequests; + +public class WorkflowActionBBFailureTest extends BaseTaskTest { + + @Mock + protected WorkflowAction workflowAction; + + @InjectMocks + @Spy + protected WorkflowActionBBFailure workflowActionBBFailure; + + @Mock + InfraActiveRequests reqMock; + + private DelegateExecution execution; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + servInstance.setServiceInstanceId("TEST"); + when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), isA(Customer.class))).thenReturn(servInstance); + workflowAction.setBbInputSetupUtils(bbSetupUtils); + workflowAction.setBbInputSetup(bbInputSetup); + } + + @Test + public void updateRequestStatusToFailed_Null_Rollback(){ + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); + execution.setVariable("retryCount", 3); + execution.setVariable("handlingCode","Success"); + execution.setVariable("gCurrentSequence",1); + WorkflowException we = new WorkflowException("WorkflowAction",1231,"Error Case"); + execution.setVariable("WorkflowException",we); + + doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + Mockito.verify( reqMock, Mockito.times(1)).setStatusMessage("Error Case"); + Mockito.verify( reqMock, Mockito.times(1)).setRequestStatus("FAILED"); + Mockito.verify( reqMock, Mockito.times(1)).setProgress(Long.valueOf(100)); + Mockito.verify( reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN"); + } + + @Test + public void updateRequestStatusToFailed(){ + execution.setVariable("mso-request-id", "123"); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", false); + InfraActiveRequests req = new InfraActiveRequests(); + WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case"); + execution.setVariable("WorkflowException", wfe); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123"); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + String errorMsg = (String) execution.getVariable("ErrorMessage"); + assertEquals("error in test case", errorMsg); + } + + @Test + public void updateRequestStatusToFailedRollback(){ + execution.setVariable("mso-request-id", "123"); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", true); + InfraActiveRequests req = new InfraActiveRequests(); + WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback"); + execution.setVariable("WorkflowException", wfe); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123"); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + String errorMsg = (String) execution.getVariable("RollbackErrorMessage"); + assertEquals("error in rollback", errorMsg); + } + + @Test + public void updateRequestStatusToFailedRollbackCompleted(){ + execution.setVariable("mso-request-id", "123"); + execution.setVariable("isRollbackComplete", true); + execution.setVariable("isRollback", true); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123"); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + String errorMsg = (String) execution.getVariable("RollbackErrorMessage"); + assertEquals("Rollback has been completed successfully.", errorMsg); + } + + @Test + public void updateRequestStatusToFailedNoWorkflowException(){ + execution.setVariable("mso-request-id", "123"); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", false); + execution.setVariable("WorkflowExceptionErrorMessage", "error in test case"); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123"); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + String errorMsg = (String) execution.getVariable("ErrorMessage"); + assertEquals("error in test case", errorMsg); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index fc269cd7cc..5c1485979e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -39,8 +39,10 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.Spy; import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -50,10 +52,16 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Mock protected WorkflowAction workflowAction; + @Mock + protected WorkflowActionBBFailure workflowActionBBFailure; + @InjectMocks @Spy protected WorkflowActionBBTasks workflowActionBBTasks; + @Mock + InfraActiveRequests reqMock; + private DelegateExecution execution; @Rule @@ -106,16 +114,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void msoCompleteProcessTest() throws Exception{ - execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + public void updateRequestStatusToCompleteTest() throws Exception{ + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); execution.setVariable("requestAction", "createInstance"); - execution.setVariable("resourceId", "123"); - execution.setVariable("source","MSO"); execution.setVariable("resourceName", "Service"); execution.setVariable("aLaCarte", true); - workflowActionBBTasks.setupCompleteMsoProcess(execution); - String response = (String) execution.getVariable("CompleteMsoProcessRequest"); - assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToComplete(execution); + assertEquals("ALaCarte-Service-createInstance request was executed correctly.",execution.getVariable("finalStatusMessage")); + } + + @Test + public void updateRequestStatusToFailedFlowStatusTest() { + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", false); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("CreateNetworkBB"); + ebb.setBuildingBlock(buildingBlock); + execution.setVariable("buildingBlock", ebb); + WorkflowException wfe = new WorkflowException("failure", 1, "failure"); + execution.setVariable("WorkflowException", wfe); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToFailed(execution); + assertEquals("CreateNetworkBB has failed.",execution.getVariable("flowStatus")); } @Test @@ -141,8 +170,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable("gCurrentSequence", 3); - doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); - + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + workflowActionBBTasks.rollbackExecutionPath(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); @@ -174,8 +203,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable("gCurrentSequence", 2); - doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); - + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + workflowActionBBTasks.rollbackExecutionPath(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); @@ -212,8 +241,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable("gCurrentSequence", 3); - doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); - + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + workflowActionBBTasks.rollbackExecutionPath(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); @@ -250,7 +279,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable("gCurrentSequence", 3); - doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); workflowActionBBTasks.rollbackExecutionPath(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); @@ -262,7 +291,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void checkRetryStatusTest(){ String reqId = "reqId123"; execution.setVariable("mso-request-id", reqId); - doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); execution.setVariable("handlingCode","Retry"); execution.setVariable("retryCount", 1); execution.setVariable("gCurrentSequence",1); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 76a807056c..5699c94137 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Matchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; @@ -49,17 +50,22 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.client.aai.entities.Relationships; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -77,14 +83,19 @@ import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.SubscriberInfo; +import org.springframework.core.env.Environment; import com.fasterxml.jackson.databind.ObjectMapper; public class WorkflowActionTest extends BaseTaskTest { + + + @Mock + protected Environment environment; @InjectMocks protected WorkflowAction workflowAction; - private DelegateExecution execution; + @Rule public ExpectedException thrown = ExpectedException.none(); @@ -112,11 +123,12 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", true); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("AssignNetwork1802BB","CreateNetworkBB","ActivateNetworkBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"AssignNetwork1802BB","CreateNetworkBB","ActivateNetworkBB"); @@ -133,11 +145,12 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", true); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("DeactivateNetworkBB","DeleteNetworkBB","UnassignNetwork1802BB"); northBoundRequest.setOrchestrationFlowList(orchFlows); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"DeactivateNetworkBB","DeleteNetworkBB","UnassignNetwork1802BB"); @@ -155,11 +168,12 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","ActivateServiceInstanceBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","ActivateServiceInstanceBB"); @@ -180,6 +194,54 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + HeatEnvironment volumeHeatEnv = new HeatEnvironment(); + vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv); + org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate volumeHeatTemplate = new HeatTemplate(); + vfModule.setVolumeHeatTemplate(volumeHeatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization(); + vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + HeatEnvironment heatEnvironment = new HeatEnvironment(); + vfModuleCustomization2.setHeatEnvironment(heatEnvironment); + org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate moduleHeatTemplate = new HeatTemplate(); + vfModule2.setModuleHeatTemplate(moduleHeatTemplate); + vfModuleCustomization2.setVfModule(vfModule2); + + VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; + vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB","AssignVfModuleBB","AssignVfModuleBB"); + } + + @Test + public void selectExecutionListServiceMacroAssignNoCloudTest() throws Exception{ + String gAction = "assignInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); @@ -205,7 +267,8 @@ public class WorkflowActionTest extends BaseTaskTest { VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"att-aic")).thenReturn(northBoundRequest); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); @@ -225,6 +288,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", false); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/si0"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB" @@ -252,7 +316,7 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB","ActivateServiceInstanceBB"); @@ -278,12 +342,13 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", false); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); - + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); @@ -301,6 +366,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); northBoundRequest.setIsToplevelflow(true); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB" @@ -310,7 +376,7 @@ public class WorkflowActionTest extends BaseTaskTest { Service service = new Service(); doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","ActivateServiceInstanceBB"); @@ -328,6 +394,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); northBoundRequest.setIsToplevelflow(true); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB" @@ -340,7 +407,7 @@ public class WorkflowActionTest extends BaseTaskTest { networkCustomization.setModelCustomizationUUID("1234"); service.getNetworkCustomizations().add(networkCustomization); doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","ActivateServiceInstanceBB"); @@ -358,6 +425,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); northBoundRequest.setIsToplevelflow(true); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB" @@ -396,7 +464,7 @@ public class WorkflowActionTest extends BaseTaskTest { service.getCollectionResourceCustomizations().add(collectionResourceCustomization); doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB" @@ -433,6 +501,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB" ,"CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB" @@ -463,7 +532,7 @@ public class WorkflowActionTest extends BaseTaskTest { VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); @@ -503,7 +572,8 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", false); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); - + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB","DeactivateNetworkBB" ,"DeleteNetworkBB","DeleteNetworkCollectionBB","DeactivateServiceInstanceBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB"); @@ -530,7 +600,7 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB" @@ -549,6 +619,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); @@ -574,7 +645,7 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"UnassignVfModuleBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignServiceInstanceBB"); @@ -592,6 +663,7 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB","DeactivateNetworkBB" ,"DeleteNetworkBB","DeleteNetworkCollectionBB","DeactivateServiceInstanceBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB"); @@ -613,13 +685,111 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs,"DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeleteNetworkCollectionBB" ,"DeactivateServiceInstanceBB","UnassignServiceInstanceBB"); } + @Test + public void selectExecutionListVnfMacroRecreateTest() throws Exception{ + String gAction = "recreateInstance"; + String resource = "Vnf"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate"); + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("vnfId", "1234"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB","CreateVfModuleBB" + ,"ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB","ActivateVnfBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB"); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("1234"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEqualsBulkFlowName(ebbs,"AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB" + ,"CreateVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB"); + } + + @Test + public void selectExecutionListVnfMacroReplaceTest() throws Exception{ + String gAction = "replaceInstance"; + String resource = "Vnf"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/replace"); + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("vnfId", "1234"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateFabricConfigurationBB","UnassignFabricConfigurationBB","DeactivateVfModuleBB","DeleteVfModuleBB" + ,"DeactivateVnfBB","ChangeModelVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB","ChangeModelVnfBB","ActivateVnfBB","ChangeModelServiceInstanceBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB"); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("1234"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + serviceInstanceMSO.getVnfs().add(vnf); + VfModule vfModuleAAI = new VfModule(); + vfModuleAAI.setVfModuleId("vfModule2"); + RelationshipList relationshipList = new RelationshipList(); + Relationship relationship = new Relationship(); + relationshipList.getRelationship().add(relationship); + vfModuleAAI.setRelationshipList(relationshipList); + Relationships relationships = new Relationships("abc"); + Configuration config = new Configuration(); + config.setConfigurationId("configId"); + Optional<Configuration> configOp = Optional.of(config); + Optional<Relationships> relationshipsOp = Optional.of(relationships); + + doReturn(relationshipsOp).when(workflowActionUtils).extractRelationshipsVnfc(isA(Relationships.class)); + doReturn(configOp).when(workflowActionUtils).extractRelationshipsConfiguration(isA(Relationships.class)); + doReturn(vfModuleAAI).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2"); + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEqualsBulkFlowName(ebbs,"AAICheckVnfInMaintBB","AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB" + ,"ChangeModelVfModuleBB" ,"ChangeModelVfModuleBB" , "CreateVfModuleBB","CreateVfModuleBB", "ActivateVfModuleBB","ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB","ChangeModelServiceInstanceBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB"); + } + @Ignore @Test public void selectExecutionListNetworkCollectionMacroCreate() throws Exception{ @@ -632,7 +802,8 @@ public class WorkflowActionTest extends BaseTaskTest { execution.setVariable("aLaCarte", false); execution.setVariable("apiVersion", "7"); execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123"); - + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","ActivateNetworkCollectionBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); @@ -644,7 +815,7 @@ public class WorkflowActionTest extends BaseTaskTest { collectionResourceCustomization.setCollectionResource(collectionResource); service.getCollectionResourceCustomizations().add(collectionResourceCustomization); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); @@ -675,7 +846,7 @@ public class WorkflowActionTest extends BaseTaskTest { collectionResourceCustomization.setCollectionResource(collectionResource); service.getCollectionResourceCustomizations().add(collectionResourceCustomization); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); @@ -797,9 +968,9 @@ public class WorkflowActionTest extends BaseTaskTest { northBoundRequest.setOrchestrationFlowList(orchFlows); List<OrchestrationFlow> macroFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB"); - when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope("replaceInstance","Vnf",false)).thenReturn(northBoundRequest); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("replaceInstance","Vnf",false,"my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows); - List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false); + List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false,"my-custom-cloud-owner"); assertEquals(flows.get(0).getFlowName(),"AAICheckVnfInMaintBB"); assertEquals(flows.get(1).getFlowName(),"AAISetVnfInMaintBB"); assertEquals(flows.get(2).getFlowName(),"DeactivateVfModuleBB"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java index 5c0a54f7db..4008240203 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java @@ -144,7 +144,7 @@ public class WorkflowActionUnitTest { flow.setFlowName("flow x"); List<OrchestrationFlow> flows = Arrays.asList(flow); - doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean()); + doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any()); workflowAction.selectExecutionList(execution); verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 8f0d00ff86..6f353fa622 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -144,7 +144,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ List<Subnet> subnetList = new ArrayList<Subnet>(); subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); - l3Network.getModelInfoNetwork().setNetworkTechnology("Contrail"); + l3Network.setNetworkTechnology("Contrail"); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java new file mode 100644 index 0000000000..70036e7480 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java @@ -0,0 +1,84 @@ +package org.onap.so.client.namingservice; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.onap.namingservice.model.NameGenDeleteResponse; +import org.onap.namingservice.model.NameGenResponse; +import org.onap.namingservice.model.Respelement; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.client.exception.BadResponseException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +public class NamingClientResponseValidatorTest extends TestDataSetup { + + private NamingClientResponseValidator responseValidator = new NamingClientResponseValidator(); + private String instanceGroupName = "generatedInstanceGroupName"; + + @Test + public void validateNameGenResponseSuccessTest() throws BadResponseException { + NameGenResponse name = new NameGenResponse(); + Respelement respElement = new Respelement(); + respElement.setResourceName("instance-group-name"); + respElement.setResourceValue(instanceGroupName); + List<Respelement> respList = new ArrayList<Respelement>(); + respList.add(respElement); + name.setElements(respList); + ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); + + String actual = responseValidator.validateNameGenResponse(resp); + + assertEquals(actual, "generatedInstanceGroupName"); + } + + @Test + public void validateNameGenResponseNoNameGeneratedTest() throws BadResponseException { + NameGenResponse name = new NameGenResponse(); + Respelement respElement = new Respelement(); + respElement.setResourceName("instance-group"); + respElement.setResourceValue(instanceGroupName); + List<Respelement> respList = new ArrayList<Respelement>(); + respList.add(respElement); + name.setElements(respList); + ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); + + String actual = responseValidator.validateNameGenResponse(resp); + + assertEquals(actual, ""); + } + + @Test + public void validateNameGenResponseBadStatusTest() throws BadResponseException { + NameGenResponse name = new NameGenResponse(); + + ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND); + + expectedException.expect(BadResponseException.class); + responseValidator.validateNameGenResponse(resp); + } + + @Test + public void validateNameGenDeleteResponseSuccessTest() throws BadResponseException { + NameGenDeleteResponse name = new NameGenDeleteResponse(); + ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); + + String actual = responseValidator.validateNameGenDeleteResponse(resp); + + assertEquals(actual, ""); + } + + @Test + public void validateNameGenDeleteResponseBadStatusTest() throws BadResponseException { + NameGenDeleteResponse name = new NameGenDeleteResponse(); + + ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND); + + expectedException.expect(BadResponseException.class); + responseValidator.validateNameGenDeleteResponse(resp); + } + +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java new file mode 100644 index 0000000000..0a2dc1e4fa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java @@ -0,0 +1,85 @@ +package org.onap.so.client.namingservice; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.so.client.namingservice.NamingRequestObjectBuilder; + +public class NamingRequestObjectBuilderTest { + + private NamingRequestObjectBuilder mapper = new NamingRequestObjectBuilder(); + private String instanceGroupId = "95cbbe59-1017-4c13-b4e8-d824e54def3e"; + private String policyInstanceName = "MSO_Policy.Config_MS_VNFInstanceGroup"; + private String namingType = "InstanceGroup"; + private String nfNamingCode = "NamingCode"; + private String instanceGroupName = "InstanceGroupName"; + + @Test + public void elementMapperTest(){ + // Expected element + Element expected = new Element(); + expected.setExternalKey(instanceGroupId); + expected.setPolicyInstanceName(policyInstanceName); + expected.setNamingType(namingType); + expected.setResourceName(instanceGroupName); + expected.setNamingIngredientsZeroOrMore(nfNamingCode); + + // Actual element + Element actual = mapper.elementMapper(instanceGroupId, policyInstanceName, namingType, nfNamingCode, instanceGroupName); + + assertThat(actual, sameBeanAs(expected)); + } + @Test + public void deleteElementMapperTest(){ + // Expected Deleteelement + Deleteelement expected = new Deleteelement(); + expected.setExternalKey(instanceGroupId); + + // Actual Deleteelement + Deleteelement actual = mapper.deleteElementMapper(instanceGroupId); + + assertThat(actual, sameBeanAs(expected)); + } + @Test + public void nameGenRequestMapper(){ + // Expected NameGenRequest + NameGenRequest expected = new NameGenRequest(); + List<Element> elements = new ArrayList<>(); + Element element = new Element(); + element.setExternalKey(instanceGroupId); + element.setPolicyInstanceName(policyInstanceName); + element.setNamingType(namingType); + element.setResourceName(instanceGroupName); + element.setNamingIngredientsZeroOrMore(nfNamingCode); + elements.add(element); + expected.setElements(elements); + + //Actual NameGenRequest + NameGenRequest actual = mapper.nameGenRequestMapper(elements); + + assertThat(actual, sameBeanAs(expected)); + } + @Test + public void nameGenDeleteRequestMapper(){ + // Expected NameGenDeleteRequest + NameGenDeleteRequest expected = new NameGenDeleteRequest(); + List<Deleteelement> deleteElements = new ArrayList<>(); + Deleteelement deleteElement = new Deleteelement(); + deleteElement.setExternalKey(instanceGroupId); + deleteElements.add(deleteElement); + expected.setElements(deleteElements); + + // Actual NameGenDeleteRequest + NameGenDeleteRequest actual = mapper.nameGenDeleteRequestMapper(deleteElements); + + assertThat(actual, sameBeanAs(expected)); + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index bd05f94c94..6b33440bd7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -283,8 +283,8 @@ public class AAINetworkResourcesTest extends TestDataSetup{ @Test public void connectNetworkToCloudRegionTest() throws Exception { aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion); - verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())),eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java index fcd6c30220..c28bc05dcb 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -40,12 +40,15 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -55,6 +58,9 @@ public class AAIVnfResourcesTest extends TestDataSetup { private GenericVnf genericVnf; private ServiceInstance serviceInstance; + + private CloudRegion cloudRegion; + @Mock protected AAIResourcesClient MOCK_aaiResourcesClient; @@ -71,6 +77,7 @@ public class AAIVnfResourcesTest extends TestDataSetup { public void before() { serviceInstance = buildServiceInstance(); genericVnf = buildGenericVnf(); + cloudRegion = buildCloudRegion(); doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } @@ -159,4 +166,20 @@ public class AAIVnfResourcesTest extends TestDataSetup { verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); assertEquals(inMaintFlag, true); } + + @Test + public void connectVnfToTenantTest() throws Exception { + aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())), + eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId()))); + } + + @Test + public void connectVnfToCloudRegionTest() throws Exception { + aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())), + eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java new file mode 100644 index 0000000000..629e98abb2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java @@ -0,0 +1,105 @@ +/*- + * ============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.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenDeleteResponse; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.namingservice.model.NameGenResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.client.namingservice.NamingClient; +import org.onap.so.client.namingservice.NamingRequestObjectBuilder; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class NamingServiceResourcesTest extends TestDataSetup{ + @InjectMocks + private NamingServiceResources namingServiceResources = new NamingServiceResources(); + + private InstanceGroup instanceGroup; + + @Mock + protected NamingRequestObjectBuilder MOCK_namingRequestObjectBuilder; + + @Mock + protected NamingClient MOCK_namingClient; + + @Before + public void before() { + instanceGroup = buildInstanceGroup(); + } + + @Test + public void generateInstanceGroupNameTest() throws Exception { + NameGenResponse name = new NameGenResponse(); + ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); + Element element = new Element(); + + NameGenRequest req = new NameGenRequest(); + doReturn(element).when(MOCK_namingRequestObjectBuilder).elementMapper(isA(String.class), isA(String.class), + isA(String.class), isA(String.class), isA(String.class)); + doReturn("generatedInstanceGroupName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class)); + doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class)); + + String generatedName = namingServiceResources.generateInstanceGroupName(instanceGroup, "policyInstanceName", "nfNamingCode"); + + verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class)); + assertEquals(generatedName, "generatedInstanceGroupName"); + } + + @Test + public void deleteInstanceGroupNameTest() throws Exception { + NameGenDeleteResponse name = new NameGenDeleteResponse(); + ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); + Deleteelement deleteElement = new Deleteelement(); + deleteElement.setExternalKey(instanceGroup.getId()); + NameGenDeleteRequest req = new NameGenDeleteRequest(); + doReturn(deleteElement).when(MOCK_namingRequestObjectBuilder).deleteElementMapper(isA(String.class)); + doReturn("").when(MOCK_namingClient).deleteNameGenRequest(isA(NameGenDeleteRequest.class)); + doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class)); + + namingServiceResources.deleteInstanceGroupName(instanceGroup); + + verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class)); + + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java index b93328ffe8..f275f3c484 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java @@ -20,10 +20,6 @@ package org.onap.so.client.orchestration; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -31,47 +27,42 @@ import static org.mockito.Mockito.verify; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; -import org.onap.so.db.catalog.beans.OrchestrationStatus; - -import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; @RunWith(MockitoJUnitRunner.Silent.class) -public class SDNCNetworkResourcesTest extends TestDataSetup{ - +public class SDNCNetworkResourcesTest extends TestDataSetup { + @InjectMocks private SDNCNetworkResources sdncNetworkResources; - + @Mock protected SDNCClient MOCK_sdncClient; - + @Mock - protected NetworkTopologyOperationRequestMapper MOCK_networkTopologyOperationRequestMapper; - + protected NetworkTopologyOperationRequestMapper MOCK_networkTopologyOperationRequestMapper; + private L3Network network; private ServiceInstance serviceInstance; private Customer customer; private RequestContext requestContext; private CloudRegion cloudRegion; - + @Before public void before() { network = buildL3Network(); @@ -81,125 +72,98 @@ public class SDNCNetworkResourcesTest extends TestDataSetup{ serviceInstance = buildServiceInstance(); requestContext = buildRequestContext(); - + cloudRegion = new CloudRegion(); } @Test public void assignNetworkTest() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); - - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.NETWORK)); - - assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void rollbackAssignNetworkTest() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); - - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.NETWORK)); - - assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void activateNetworkTest() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); - - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.NETWORK)); - - assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void deleteNetworkTest() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); - - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); - + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.NETWORK)); - - assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void test_deactivateNetwork() throws MapperException, BadResponseException { - serviceInstance.getNetworks().add(network); - - Customer customer = new Customer(); - customer.setGlobalCustomerId("gcustId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - GenericResourceApiNetworkOperationInformation expectedGenericResourceApiNetworkOperationInformation = new GenericResourceApiNetworkOperationInformation(); - - String expectedResponse = "response"; - - doReturn(expectedResponse).when(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); - - doReturn(expectedGenericResourceApiNetworkOperationInformation).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - - String actualResponse = sdncNetworkResources.deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); - - assertEquals(expectedResponse, actualResponse); + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); + sdncNetworkResources.deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void changeAssignNetworkTest() throws MapperException, BadResponseException { - String expectedSdncResponse = "SDNCChangeAssignNetworkResponse"; - - serviceInstance.getNetworks().add(network); - - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - GenericResourceApiNetworkOperationInformation sdncReq = new GenericResourceApiNetworkOperationInformation(); - - doReturn(sdncReq).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); - - doReturn(expectedSdncResponse).when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), isA(SDNCTopology.class)); - - String actualSdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); - - verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); - verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.NETWORK); - assertEquals(actualSdncResponse, expectedSdncResponse); + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); + sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); } - + @Test public void unassignNetwork_Test() throws Exception { - network.setOrchestrationStatus(OrchestrationStatus.CREATED); - - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); - - sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, - requestContext, cloudRegion); - - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.NETWORK)); - - assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); - } + doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper) + .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, + customer, requestContext, cloudRegion); + sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, + GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java index 42672e1180..509dc1de0d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java @@ -21,7 +21,7 @@ package org.onap.so.client.orchestration; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; @@ -30,121 +30,100 @@ import static org.mockito.Mockito.verify; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; - @RunWith(MockitoJUnitRunner.Silent.class) public class SDNCServiceInstanceResourcesTest extends TestDataSetup{ + @InjectMocks private SDNCServiceInstanceResources sdncServiceInstanceResources; - - @Mock protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper; - private RequestContext requestContext; private ServiceInstance serviceInstance; private Customer customer; - @Mock - protected SDNCClient MOCK_sdncClient; - @Before public void before() { requestContext = buildRequestContext(); - serviceInstance = buildServiceInstance(); - customer = buildCustomer(); - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); } @Test public void assignServiceInstanceSuccessTest() throws Exception { doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); } @Test public void assignServiceInstanceExceptionTest() throws Exception { expectedException.expect(Exception.class); - doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); } @Test public void deleteServiceInstanceSuccessTest() throws Exception { doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); } @Test public void deleteServiceInstanceExceptionTest() throws Exception { expectedException.expect(Exception.class); - doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); } @Test public void unassignServiceInstanceSuccessTest() throws Exception { doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); } @Test public void unassignServiceInstanceExceptionTest() throws Exception { expectedException.expect(Exception.class); - doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); sdncServiceInstanceResources.unassignServiceInstance(serviceInstance,customer, requestContext); } @Test public void deactivateServiceInstanceSuccessTest() throws Exception { - doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); - verify(MOCK_sdncClient, times(1)).post(ArgumentMatchers.isNull(), eq(SDNCTopology.SERVICE)); + verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); } @Test public void deactivateServiceInstanceExceptionTest() throws Exception { expectedException.expect(Exception.class); - doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); } @Test public void test_changeModelServiceInstance() throws MapperException, BadResponseException { doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java index e27f0fcfa1..7d05758129 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java @@ -20,8 +20,6 @@ package org.onap.so.client.orchestration; -import static org.mockito.Matchers.eq; -import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -31,8 +29,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -43,16 +41,18 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; - -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;; @RunWith(MockitoJUnitRunner.Silent.class) public class SDNCVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks - private SDNCVfModuleResources sdncVfModuleResources = new SDNCVfModuleResources(); + private SDNCVfModuleResources sdncVfModuleResources; + + @Mock + protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper; private VfModule vfModule; private GenericVnf vnf; @@ -61,12 +61,7 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup{ private Customer customer; private CloudRegion cloudRegion; private RequestContext requestContext; - - @Mock - protected SDNCClient MOCK_sdncClient; - - @Spy - protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper; + private GenericResourceApiVfModuleOperationInformation sdncReq; @Before public void before() { @@ -77,50 +72,51 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup{ customer = buildCustomer(); cloudRegion = buildCloudRegion(); requestContext = buildRequestContext(); + sdncReq = new GenericResourceApiVfModuleOperationInformation(); } @Test - public void assignVfModuleTest() throws MapperException, BadResponseException { - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); - + public void assignVfModuleTest() throws MapperException { + doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, + volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, + volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); } @Test - public void unassignVfModuleTest() throws MapperException, BadResponseException { - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); - + public void unassignVfModuleTest() throws MapperException { + doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, + vnf, serviceInstance, null, null, null, null); sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, + vnf, serviceInstance, null, null, null, null); } @Test - public void activateVfModuleTest() throws MapperException, BadResponseException { - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); - + public void activateVfModuleTest() throws MapperException { + doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); } @Test - public void deactivateVfModuleTest() throws MapperException, BadResponseException { - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); - + public void deactivateVfModuleTest() throws MapperException { + doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, + vnf, serviceInstance, customer, cloudRegion, requestContext, null); } @Test public void changeAssignVfModuleTest() throws MapperException, BadResponseException { - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); - + doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, + null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, + null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java index 3329842924..9bbf790ecb 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java @@ -20,10 +20,9 @@ package org.onap.so.client.orchestration; -import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -49,7 +48,6 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; @RunWith(MockitoJUnitRunner.Silent.class) @@ -73,112 +71,83 @@ public class SDNCVnfResourcesTest extends TestDataSetup{ @Before public void before() { serviceInstance = buildServiceInstance(); - genericVnf = buildGenericVnf(); - customer = buildCustomer(); - cloudRegion = buildCloudRegion(); - requestContext = buildRequestContext(); - sdncReq = new GenericResourceApiVnfOperationInformation(); } @Test - public void assignVnfTest() throws MapperException, BadResponseException { + public void assignVnfTest() { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); - sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); } @Test - public void activateVnfTest() throws MapperException, BadResponseException { + public void activateVnfTest() { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); - sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); } @Test - public void deleteVnfTest() throws MapperException, BadResponseException { - doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); - + public void deleteVnfTest() { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); } @Test public void queryVnfTest() throws MapperException, BadResponseException { doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); - genericVnf.setSelflink("testSelflink"); - sdncVnfResources.queryVnf(genericVnf); - verify(MOCK_sdncClient, times(1)).get(isA(String.class)); } @Test public void queryVnfWithResourcePrefixTest() throws MapperException, BadResponseException { doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); - genericVnf.setSelflink("restconf/test:testSelflink"); - sdncVnfResources.queryVnf(genericVnf); - verify(MOCK_sdncClient, times(1)).get(isA(String.class)); } @Test - public void changeModelVnfTest() throws MapperException, BadResponseException { + public void changeModelVnfTest() { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); - doReturn("SDNCChangeModelVnfResponse").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), isA(SDNCTopology.class)); - - String actualResponse = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - + sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.VNF); - assertEquals("SDNCChangeModelVnfResponse", actualResponse); } @Test - public void deactivateVnfSuccessTest() throws Exception { + public void deactivateVnfSuccessTest() { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); } - @Test(expected = Exception.class) - public void deactivateVnfExceptionTest() throws Exception { - doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + @Test + public void deactivateVnfExceptionTest() { + expectedException.expect(Exception.class); + doThrow(Exception.class).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); } @Test public void unassignVnfSuccessTest() throws Exception { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); - doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); } - @Test(expected = Exception.class) + @Test public void unassignVnfExceptionTest() throws Exception { - doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); - doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + expectedException.expect(Exception.class); + doThrow(Exception.class).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - //verify(client, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.VNF)); } - } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java index e30fe660c3..2636aec4a7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java @@ -60,12 +60,13 @@ public class SdnCommonTasksTest{ @Test public void validateSDNResponseTest() throws BadResponseException { + String jsonResponse = "{\"output\":{\"response-code\":\"0\",\"response-message\":\"success\"}}"; LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>(); LinkedHashMap<String, Object> output = new LinkedHashMap<>(); output.put("response-code", "0"); output.put("response-message", "success"); responseMap.put("output", output); - assertEquals("success", sdnCommonTasks.validateSDNResponse(responseMap)); + assertEquals(jsonResponse, sdnCommonTasks.validateSDNResponse(responseMap)); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java index cc1c5c5329..9117b8ea64 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java @@ -77,6 +77,6 @@ public class SDNCClientIT extends BaseIntegrationTest { .withHeader("Content-Type", "application/json").withBody(responseJson))); String response = SPY_sdncClient.post("", SDNCTopology.NETWORK); - JSONAssert.assertEquals("", response, false); + JSONAssert.assertEquals(responseJson, response, true); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java index 54ca116d55..63c3680e8c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -67,7 +67,7 @@ public class VnfTopologyOperationRequestMapperTest { genericVnf.setModelCustomizationUuid("vnfModelCustomizationUUID"); ModelInfoInstanceGroup modelL3Network = new ModelInfoInstanceGroup(); - modelL3Network.setType("networkInstanceGroup"); + modelL3Network.setType("L3-NETWORK"); InstanceGroup instanceGroup1 = new InstanceGroup(); instanceGroup1.setId("l3-network-ig-111"); diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json index 7b369ab97e..579075f502 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json @@ -8,6 +8,7 @@ "modelVersion": "10" }, "cloudConfiguration": { + "cloudOwner" : "my-custom-cloud-owner", "lcpCloudRegionId": "mdt1", "tenantId": "88a6ca3ee0394ade9403f075db23167e" }, diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json index 771283c603..26838024da 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json @@ -7,6 +7,9 @@ "modelName": "MOW AVPN vMX BV vPE 1 Service", "modelVersion": "10.0" }, + "cloudConfiguration": { + "cloudOwner" : "my-custom-cloud-owner" + }, "owningEntity": { "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", "owningEntityName": "PACKET CORE" diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json index 51caddd48a..ddb118ea49 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json @@ -7,6 +7,9 @@ "modelName": "MOW AVPN vMX BV vPE 1 Service", "modelVersion": "10.0" }, + "cloudConfiguration": { + "cloudOwner" : "my-custom-cloud-owner" + }, "owningEntity": { "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", "owningEntityName": "PACKET CORE" diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json new file mode 100644 index 0000000000..51caddd48a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json @@ -0,0 +1,125 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ] + } + } + } + ] + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/VnfMacroReplace.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/VnfMacroReplace.json new file mode 100644 index 0000000000..5c34903e30 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/VnfMacroReplace.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "2b80014c-851a-4051-a2f0-2994fcf26164", + "modelVersionId": "038111e7-dfb6-4875-ba06-d1fc1306b471", + "modelName": "Resource", + "modelVersion": "4.0", + "modelCustomizationName": "Resource 0", + "modelCustomizationId": "5769aaa9-84f0-4b9d-bf8a-d891e5c461e1" + }, + "cloudConfiguration": { + "cloudOwner": "cloud-owner", + "lcpCloudRegionId": "abc3", + "tenantId": "ab33582f8d3948078dc8c18d6834bf75" + }, + "requestInfo": { + "source": "VID", + "requestorId": "test" + }, + "requestParameters": { + "testApi": "GR_API" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 4ecdc721f0..3d45caddce 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -41,6 +41,9 @@ pnf: consumerId: consumerId topicListenerDelayInSeconds: 5 mso: + naming: + endpoint: http://localhost:${wiremock.server.port}/web/service/v1/genNetworkElementName + auth: Basic YnBlbDptc28tZGItMTUwNyE= adapters: requestDb: auth: Basic YnBlbDptc28tZGItMTUwNyE= @@ -90,6 +93,7 @@ mso: bpmn: optimisticlockingexception: retrycount: '3' + cloudRegionIdsToSkipAddingVnfEdgesTo: test25Region1,test25Region2,test25Region99 callbackRetryAttempts: '5' catalog: db: @@ -182,6 +186,10 @@ oof: host: http://localhost:${wiremock.server.port} uri: /api/oof/v1/placement headers.auth: Basic dGVzdDp0ZXN0cHdk +org: + onap: + so: + cloud-owner: att-aic spring: datasource: jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn |