diff options
Diffstat (limited to 'bpmn')
151 files changed, 4983 insertions, 3253 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/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index f1eab6601b..103326a693 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 @@ -22,17 +22,12 @@ package org.onap.so.bpmn.common.scripts import org.json.JSONObject; import org.json.JSONArray; -import org.json.XML 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.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 javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -57,365 +52,6 @@ class CatalogDbUtils { JsonUtils jsonUtils = new 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") @@ -436,33 +72,6 @@ class CatalogDbUtils { 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 - } - public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) { JSONArray vnfsList = null String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") @@ -489,263 +98,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") @@ -769,26 +121,6 @@ class CatalogDbUtils { 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); - throw e - } - - return resources - } - public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) { String resources = null String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") @@ -833,27 +165,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 +189,6 @@ class CatalogDbUtils { return resources } - - private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { JSONArray modelInfos = null @@ -1004,58 +313,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 +365,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 +383,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); 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/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..250cdda0a1 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.create(new URL(url), MediaType.APPLICATION_JSON, 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.create(new URL(url), MediaType.APPLICATION_JSON, 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/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy index 863338548e..e7f46464ee 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.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. @@ -17,31 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.so.bpmn.common.scripts -package org.onap.so.client.restproperties; +import org.onap.so.client.HttpClientFactory -import org.junit.Test; +class ExternalAPIUtilFactory { -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 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); - } + 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/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..41db603cdf 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 @@ -26,7 +26,6 @@ import org.onap.aai.domain.yang.L3Network 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 +43,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 +280,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> @@ -570,56 +386,6 @@ class NetworkUtils { } /** - * 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 @@ -845,40 +611,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() @@ -1056,74 +788,6 @@ class NetworkUtils { } - // 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) - } - 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>" - } - return rebuildingSubnets - } - def buildVlans(queryIdResponse) { def rebuildingSubnets = "<vlans>" def subnetsData = new XmlSlurper().parseText(queryIdResponse) 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..0cefae526e 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 @@ -207,7 +207,10 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl); - HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SDNC_ADAPTER) + HttpClient httpClient = new HttpClient(url, "application/json", 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/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..1452a9ad8d 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 @@ -29,6 +29,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 + @@ -311,7 +313,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { HttpClient httpClient = new HttpClient(url, "application/xml", 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)) { 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..7df9c7bf82 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; @@ -261,17 +262,20 @@ public class ResourceRequestBuilder { 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); + 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 +287,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..0017c4eeb1 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); 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/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/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..5f428f1f9f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -0,0 +1,199 @@ +/*- + * ============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.create(new URL(URL), MediaType.APPLICATION_JSON, 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.create(new URL(URL), MediaType.APPLICATION_JSON, 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.create(new URL(URL), MediaType.APPLICATION_JSON, 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.create(new URL(URL), MediaType.APPLICATION_JSON, 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/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/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/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/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/pom.xml b/bpmn/pom.xml index a7b49bc52a..c66178b182 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -64,7 +64,7 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> + <version>3.11.1</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/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..2ca9437e9b 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 @@ -43,7 +43,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> @@ -79,7 +79,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 +116,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 +164,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"> 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..45dafbe606 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 @@ -92,7 +92,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..e7e8ac0631 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,6 +33,7 @@ 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(); 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/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/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index e3702f1014..2a2d1f494d 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 @@ -31,6 +31,7 @@ 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 @@ -43,11 +44,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 +112,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 +140,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 +158,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 +174,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 +186,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 +203,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 +225,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 +250,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 +262,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 HttpClient(url, "application/json", 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/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/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index c9497165c4..91b6c2af06 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 @@ -868,7 +868,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/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index a3c30dcb50..1e7f731708 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 @@ -31,6 +31,7 @@ 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 @@ -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 HttpClient(url, "application/json", 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/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/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index d855479694..ee094b03e3 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 @@ -32,6 +32,7 @@ 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,11 +42,6 @@ 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() @@ -83,6 +79,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 +133,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 +153,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 +173,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 +219,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 = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) apiResponse = httpClient.post(requestBody) @@ -216,7 +232,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 +250,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 = new HttpClient(url, "application/json", 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/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/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-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..ebd1affea5 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> @@ -95,7 +125,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/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/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index fedec4f732..58c6db109c 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 @@ -32,6 +32,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 +62,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"); 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..e04043a352 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,12 @@ 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); + } Resource resource = extractResourceIdAndTypeFromUri(uri); WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); @@ -160,12 +177,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 +258,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 +270,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 +286,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 +339,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 +347,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 +363,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 +382,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){ @@ -539,6 +562,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 +1027,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..7e6eb2a23d --- /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.of(errorMsg); + } + + 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..d9125e4104 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 @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -57,6 +58,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 @@ -207,7 +210,7 @@ public class WorkflowActionBBTasks { String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); 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); @@ -267,7 +270,7 @@ public class WorkflowActionBBTasks { } } - updateRequestErrorStatusMessage(execution); + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); if (rollbackFlows.isEmpty()) execution.setVariable("isRollbackNeeded", false); @@ -282,93 +285,4 @@ public class WorkflowActionBBTasks { workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state."); } } - - protected void updateRequestErrorStatusMessage(DelegateExecution execution) { - try { - String requestId = (String) execution.getVariable(G_REQUEST_ID); - InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - String errorMsg = retrieveErrorMessage(execution); - if(errorMsg == null || errorMsg.equals("")){ - errorMsg = "Failed to determine error message"; - } - request.setStatusMessage(errorMsg); - logger.debug("Updating RequestDB to failed: errorMsg = " + 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 abortCallErrorHandling(DelegateExecution execution) { - String msg = "Flow has failed. Rainy day handler has decided to abort the process."; - logger.error(msg); - throw new BpmnError(msg); - } - - public void updateRequestStatusToFailed(DelegateExecution execution) { - try { - String requestId = (String) execution.getVariable(G_REQUEST_ID); - InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - String errorMsg = null; - String rollbackErrorMsg = null; - boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete"); - boolean isRollbackFailure = (boolean) execution.getVariable("isRollback"); - - if(rollbackCompleted){ - rollbackErrorMsg = "Rollback has been completed successfully."; - request.setRollbackStatusMessage(rollbackErrorMsg); - logger.debug("Updating RequestDB to failed: Rollback has been completed successfully"); - }else{ - if(isRollbackFailure){ - rollbackErrorMsg = retrieveErrorMessage(execution); - if(rollbackErrorMsg == null || rollbackErrorMsg.equals("")){ - rollbackErrorMsg = "Failed to determine rollback error message."; - } - request.setRollbackStatusMessage(rollbackErrorMsg); - logger.debug("Updating RequestDB to failed: rollbackErrorMsg = " + rollbackErrorMsg); - }else{ - errorMsg = retrieveErrorMessage(execution); - if(errorMsg == null || errorMsg.equals("")){ - errorMsg = "Failed to determine error message"; - } - request.setStatusMessage(errorMsg); - logger.debug("Updating RequestDB to failed: errorMsg = " + 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 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(); - } - } catch (Exception ex) { - //log error and attempt to extact WorkflowExceptionMessage - logger.error("Failed to extract workflow exception from execution.",ex); - } - - if (errorMsg == null){ - try { - errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); - } catch (Exception ex) { - logger.error("Failed to extract workflow exception message from WorkflowException",ex); - errorMsg = "Unexpected Error in BPMN."; - } - } - return errorMsg; - } - - public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) { - execution.setVariable("isRollbackComplete", true); - updateRequestStatusToFailed(execution); - } } 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/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/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/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..189ecb96c7 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 @@ -141,8 +149,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 +182,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 +220,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 +258,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 +270,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/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 |