diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
38 files changed, 317 insertions, 2872 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 81e2b40bb2..cae80e9137 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -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. @@ -28,8 +28,6 @@ import org.onap.so.rest.RESTConfig import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - - class AaiUtil { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class); @@ -101,6 +99,15 @@ class AaiUtil { return uri } + public String getAAIServiceInstanceUri(DelegateExecution execution) { + String uri = getBusinessCustomerUri(execution) + + uri = uri +"/" + execution.getVariable("globalSubscriberId") + "/service-subscriptions/service-subscription/" + UriUtils.encode(execution.getVariable("serviceType"),"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(execution.getVariable("serviceInstanceId"),"UTF-8") + + msoLogger.debug('AaiUtil.getAAIRequestInputUri() - AAI URI: ' + uri) + return uri + } + //public String getBusinessCustomerUriv7(DelegateExecution execution) { // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) // def uri = getUri(execution, 'Customer') @@ -646,4 +653,85 @@ class AaiUtil { return 0 } } + + private def getPInterface(DelegateExecution execution, String aai_uri) { + + String namespace = getNamespaceFromUri(aai_uri) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = ${aai_endpoint}${aai_uri} + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + return new XmlParser().parseText(response.getResponseBodyAsString()) + } + + // This method checks if interface is remote + private def isPInterfaceRemote(DelegateExecution execution, String uri) { + if(uri.contains("ext-aai-network")) { + return true + } else { + return false + } + } + + // This method returns Local and remote TPs information from AAI + public Map getTPsfromAAI(DelegateExecution execution) { + Map tpInfo = [:] + + String aai_uri = '/aai/v14/network/logical-links' + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = ${aai_endpoint}${aai_uri} + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + + def logicalLinks = new XmlParser().parseText(response.getResponseBodyAsString()) + + logicalLinks."logical-links".find { link -> + def pInterface = [] + def relationship = link."relationship-list"."relationship" + relationship.each { + if ("p-interface".compareToIgnoreCase(it."related-to")) { + pInterface.add(it) + } + } + if (pInterface.size() == 2) { + def localTP = null + def remoteTP = null + + if (pInterface[0]."related-link".contains("ext-aai-networks")) { + remoteTP = pInterface[0] + localTP = pInterface[1] + } + + if (pInterface[1]."related-link".contains("ext-aai-networks")) { + localTP = pInterface[0] + remoteTP = pInterface[1] + } + + if (localTP != null && remoteTP != null) { + + // give local tp + var intfLocal = getPInterface(execution, localTP."related-link") + tpInfotpInfo.put("local-access-node-id", localTP."related-link".split("/")[6]) + + def networkRef = intfLocal."network-ref".split("/") + tpInfo.put("local-access-provider-id", networkRef[1]) + tpInfo.put("local-access-client-id", networkRef[3]) + tpInfo.put("local-access-topology-id", networkRef[5]) + tpInfo.put("local-access-ltp-id", localTP."interface-name") + + // give local tp + var intfRemote = getPInterface(execution, remoteTP."related-link") + tpInfo.put("remote-access-node-id", remoteTP."related-link".split("/")[6]) + def networkRefRemote = intfRemote."network-ref".split("/") + tpInfo.put("remote-access-provider-id", networkRefRemote[1]) + tpInfo.put("remote-access-client-id", networkRefRemote[3]) + tpInfo.put("remote-access-topology-id", networkRefRemote[5]) + tpInfo.put("remote-access-ltp-id", remoteTP."interface-name") + } + } + + } + return tpInfo + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy deleted file mode 100644 index 5aef1d6ea5..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy +++ /dev/null @@ -1,440 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class CustomE2EGetService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EGetService.class); - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - msoLogger.debug("Incoming GENGS_type is: " + type) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - msoLogger.debug("Service Instance Node Query Url is: " + path) - msoLogger.debug("Service Instance Node Query Url is: " + path) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("Generic Query Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Generic Query Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Generic Query Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug("Generic Query Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService GetServiceObject Process") - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceEndpoint = "" - - msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - msoLogger.debug(" GET Service response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - msoLogger.debug("GET Service Received a Good Response Code") - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - msoLogger.debug("GET Service Response Contains a service-instance" ) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - msoLogger.debug("GET Service Response Does NOT Contain Data" ) - } - }else if(responseCode == 404){ - msoLogger.debug("GET Service Received a Not Found (404) Response") - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") - } - -}
\ No newline at end of file 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 de5408fac5..4b701e6a58 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 @@ -381,15 +381,22 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { msoLogger.debug("Started processJavaException Method") // if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE String javaExpMsg = execution.getVariable("BPMN_javaExpMsg") + String errorMessage = execution.getVariable("gUnknownError") String wfeExpMsg = "Catch a Java Lang Exception in " + processKey if (javaExpMsg != null && !javaExpMsg.empty) { wfeExpMsg = wfeExpMsg + ": " + javaExpMsg } + if (errorMessage != null && !errorMessage.empty) { + msoLogger.error("Unknown Error: " + errorMessage); + } + msoLogger.error("Java Error: " + wfeExpMsg); buildWorkflowException(execution, 2500, wfeExpMsg) }catch(BpmnError b){ + msoLogger.error(b); throw b }catch(Exception e){ + msoLogger.error(e); msoLogger.debug("Caught Exception during processJavaException Method: " + e) buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") } 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 3646f26fb6..2c2cd8269c 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 @@ -22,6 +22,7 @@ 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.so.logger.MsoLogger import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -36,8 +37,8 @@ class ExternalAPIUtil { public MsoUtils utils = new MsoUtils() ExceptionUtil exceptionUtil = new ExceptionUtil() - - private AbstractServiceTaskProcessor taskProcessor + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) public static final String PostServiceOrderRequestsTemplate = "{\n" + @@ -62,6 +63,7 @@ class ExternalAPIUtil { "\t\t\"action\": <action>,\n" + "\t\t\"service\": {\n" + "\t\t\t\"serviceState\": <serviceState>,\n" + + "\t\t\t\"id\": <serviceId>,\n" + "\t\t\t\"name\": <serviceName>,\n" + "\t\t\t\"serviceSpecification\": { \n" + "\t\t\t\t\"id\": <serviceUuId> \n" + @@ -81,16 +83,12 @@ class ExternalAPIUtil { "\t} \n" + "}" - public ExternalAPIUtil(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } // public String getUri(DelegateExecution execution, resourceName) { // -// def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') // def uri = execution.getVariable("ExternalAPIURi") // if(uri) { -// taskProcessor.logDebug("ExternalAPIUtil.getUri: " + uri, isDebugLogEnabled) +// msoLogger.debug("ExternalAPIUtil.getUri: " + uri) // return uri // } // @@ -98,21 +96,21 @@ class ExternalAPIUtil { // } public String setTemplate(String template, Map<String, String> valueMap) { - taskProcessor.logDebug("ExternalAPIUtil setTemplate", true); + msoLogger.debug("ExternalAPIUtil setTemplate", true); StringBuffer result = new StringBuffer(); String pattern = "<.*>"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(template); - taskProcessor.logDebug("ExternalAPIUtil template:" + template, true); + msoLogger.debug("ExternalAPIUtil template:" + template, true); while (m.find()) { String key = template.substring(m.start() + 1, m.end() - 1); - taskProcessor.logDebug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true); + msoLogger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true); m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); } m.appendTail(result); - taskProcessor.logDebug("ExternalAPIUtil return:" + result.toString(), true); + msoLogger.debug("ExternalAPIUtil return:" + result.toString(), true); return result.toString(); } @@ -128,13 +126,12 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIGetCall(DelegateExecution execution, String url){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug(" ======== STARTED Execute ExternalAPI Get Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ") APIResponse apiResponse = null try{ String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "Generated uuid is: " + uuid) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) @@ -146,9 +143,9 @@ class ExternalAPIUtil { } apiResponse = client.get() - taskProcessor.logDebug( "======== COMPLETED Execute ExternalAPI Get Process ======== ", isDebugEnabled) + msoLogger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ") }catch(Exception e){ - taskProcessor.logDebug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse @@ -167,13 +164,12 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIPostCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ") APIResponse apiResponse = null try{ String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "Generated uuid is: " + uuid) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) RESTConfig config = new RESTConfig(url); @@ -184,9 +180,9 @@ class ExternalAPIUtil { } apiResponse = client.httpPost(payload) - taskProcessor.logDebug( "======== Completed Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ") }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse @@ -208,11 +204,10 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ") APIResponse apiResponse = null try{ - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) @@ -223,9 +218,9 @@ class ExternalAPIUtil { } apiResponse = client.httpPost(payload) - taskProcessor.logDebug( "======== Completed Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ") }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy deleted file mode 100644 index 857df16772..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy +++ /dev/null @@ -1,470 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import org.onap.so.bpmn.core.UrnPropertiesReader - -import org.apache.commons.lang3.StringEscapeUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - -import static org.apache.commons.lang3.StringUtils.isBlank - - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class GenericGetService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetService.class); - - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - msoLogger.debug("Incoming GENGS_type is: " + type) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - msoLogger.debug("Service Instance Node Query Url is: " + path) - msoLogger.debug("Service Instance Node Query Url is: " + path) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("Generic Query Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Generic Query Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Generic Query Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug("Generic Query Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId) - if(nodeExists){ - msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService GetServiceObject Process") - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceEndpoint = "" - - msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - msoLogger.debug(" GET Service response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - msoLogger.debug("GET Service Received a Good Response Code") - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - msoLogger.debug("GET Service Response Contains a service-instance" ) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - msoLogger.debug("GET Service Response Does NOT Contain Data" ) - } - }else if(responseCode == 404){ - msoLogger.debug("GET Service Received a Not Found (404) Response") - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") - } - - /** - * An utility method which check whether a service(by name) is already present within a globalCustomerId or not. - * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name. - * @param globalCustomerId - * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases. - */ - public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) { - if (isBlank(aaiResponse)) { - return false - } - aaiResponse = utils.removeXmlNamespaces(aaiResponse) - ArrayList<String> linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link") - if (linksArray == null || linksArray.size() == 0) { - return false - } - for (String resourceLink : linksArray) { - int custStart = resourceLink.indexOf("customer/") - int custEnd = resourceLink.indexOf("/service-subscriptions/") - String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd) - if (globalCustomerId.equals(receivedCustomerId)) { - return true - } - } - return false - } - -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy index d41134be91..8cc756d412 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -67,7 +67,7 @@ import org.onap.so.logger.MsoLogger * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. * * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * should check if a service-instance or servic-subscription exists by calling the subflow. if it exists then resourceversion should be * obtained from aai and sent as an input parameter. * * Outgoing Variables: @@ -104,7 +104,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{ String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") String type = execution.getVariable("GENPS_type") - + if(type != null){ msoLogger.debug("Incoming GENPS_type is: " + type) if(type.equalsIgnoreCase("service-instance")){ @@ -201,7 +201,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{ String serviceType = execution.getVariable("GENPS_serviceType") msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) - + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index d3ddc60d3e..ca1acc5963 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -48,8 +48,8 @@ public class PayloadClient { UpgradeAction payloadResult = new UpgradeAction(); ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); String payloadString = payload.isPresent() ? payload.get() : ""; - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); + String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing_software_version"); + String newSoftware = JsonUtils.getJsonValue(payloadString, "new_software_version"); configParams.setExistingSoftwareVersion(existingSoftware); configParams.setNewSoftwareVersion(newSoftware); configParams.setVnfName(vnfName); @@ -69,7 +69,7 @@ public class PayloadClient { QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); String payloadString = payload.isPresent() ? payload.get() : ""; - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); + String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations_timeout"); configParams.setOperationsTimeout(operationsTimeout); configParams.setVnfName(vnfName); payloadResult.setConfigurationParameters(configParams); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index ff51b06dbe..6bd397a63a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -27,15 +27,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "vnf_name", -"existing-software-version", -"new-software-version" +"existing_software_version", +"new_software_version" }) public class ConfigurationParametersUpgrade { @JsonProperty("vnf_name") private String vnfName; -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") private String existingSoftwareVersion; -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") private String newSoftwareVersion; @JsonProperty("vnf_name") @@ -48,22 +48,22 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public String getExistingSoftwareVersion() { return existingSoftwareVersion; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public void setExistingSoftwareVersion(String existingSoftwareVersion) { this.existingSoftwareVersion = existingSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public String getNewSoftwareVersion() { return newSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public void setNewSoftwareVersion(String newSoftwareVersion) { this.newSoftwareVersion = newSoftwareVersion; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 5746dcd586..38f974168e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -38,6 +38,8 @@ public class BuildingBlock implements Serializable{ private String key; @JsonProperty("is-virtual-link") private boolean isVirtualLink; + @JsonProperty("virtual-link-key") + private String virtualLinkKey; public String getBpmnFlowName() { return bpmnFlowName; @@ -63,4 +65,10 @@ public class BuildingBlock implements Serializable{ public void setIsVirtualLink(boolean isVirtualLink) { this.isVirtualLink = isVirtualLink; } + public String getVirtualLinkKey() { + return virtualLinkKey; + } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java index 6ceac935f1..349010781d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -27,7 +27,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoCollection implements Serializable { private static final long serialVersionUID = 8380534468706675508L; - + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUUID; @JsonProperty("model-version-id") private String modelVersionId; @JsonProperty("model-invariant-uuid") @@ -43,6 +45,12 @@ public class ModelInfoCollection implements Serializable { @JsonProperty("quantity") private int quantity; + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } public String getModelVersionId() { return modelVersionId; } 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 aa68114011..b5203c676a 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 @@ -65,6 +65,7 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; @@ -246,14 +247,18 @@ public class BBInputSetup implements JavaDelegate { org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); if (modelType.equals(ModelType.network)) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId); this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); } else if (modelType.equals(ModelType.vnf)) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); } else if (modelType.equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); } else if (modelType.equals(ModelType.vfModule)) { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); } else { @@ -320,8 +325,6 @@ public class BBInputSetup implements JavaDelegate { protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, CloudConfiguration cloudConfiguration) throws Exception { - boolean foundByName = false; - boolean foundById = false; String vnfModelCustomizationUUID = null; if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { @@ -349,29 +352,31 @@ public class BBInputSetup implements JavaDelegate { cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + break; } } break; } } if (vnf != null) { - for (VfModule vfModule : vnf.getVfModules()) { + VfModule vfModule = null; + for (VfModule vfModuleTemp : vnf.getVfModules()) { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null - && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { - foundById = true; - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); - } else if (instanceName != null && vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + vfModule = vfModuleTemp; + String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + modelInfo.setModelCustomizationId(vfModuleCustId); + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { - VfModule vfModule = this.createVfModule(lookupKeyMap, + if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); vnf.getVfModules().add(vfModule); } + if(vfModule != null) { + mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } } else { msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); @@ -422,48 +427,47 @@ public class BBInputSetup implements JavaDelegate { protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception { - boolean foundByName = false; - boolean foundById = false; + VolumeGroup volumeGroup = null; + GenericVnf vnf = null; String vnfModelCustomizationUUID = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + break; } } } - GenericVnf vnf = null; for (GenericVnf tempVnf : serviceInstance.getVnfs()) { if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { vnf = tempVnf; - vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) .getModelCustomizationId(); ModelInfo vnfModelInfo = new ModelInfo(); vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + mapCatalogVnf(tempVnf, vnfModelInfo, service); break; } } if (vnf != null && vnfModelCustomizationUUID != null) { - for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId() .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { - foundById = true; - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); - } else if (instanceName != null && volumeGroup.getVolumeGroupName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + volumeGroup = volumeGroupTemp; + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { - if (vnfType == null || vnfType.isEmpty()) { - vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); - } - VolumeGroup volumeGroup = this.createVolumeGroup(lookupKeyMap, resourceId, instanceName, vnfType, instanceParams); + if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + volumeGroup = createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams); vnf.getVolumeGroups().add(volumeGroup); - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + if(volumeGroup != null) { + mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); } } else { msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); @@ -521,10 +525,13 @@ public class BBInputSetup implements JavaDelegate { org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams) { - boolean foundByName = false; - boolean foundById = false; + GenericVnf vnf = null; ModelInfo instanceGroupModelInfo = null; String instanceGroupId = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); @@ -534,36 +541,26 @@ public class BBInputSetup implements JavaDelegate { } } } - for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + for (GenericVnf vnfTemp : serviceInstance.getVnfs()) { if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null - && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - foundById = true; - org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); - if(vnf!=null){ - modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); - } - this.mapCatalogVnf(genericVnf, modelInfo, service); - } else if (instanceName != null && genericVnf.getVnfName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); - org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); - if(vnf!=null){ - modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); - } - this.mapCatalogVnf(genericVnf, modelInfo, service); + && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + String vnfModelCustId = bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId(); + modelInfo.setModelCustomizationUuid(vnfModelCustId); + vnf = vnfTemp; + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { - if(vnfType == null || vnfType.isEmpty()) { - vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, generatedVnfType, instanceParams); + serviceInstance.getVnfs().add(vnf); + } + if(vnf != null) { + mapCatalogVnf(vnf, modelInfo, service); + mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null) { + mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); } - GenericVnf genericVnf = this.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, vnfType, instanceParams); - serviceInstance.getVnfs().add(genericVnf); - this.mapCatalogVnf(genericVnf, modelInfo, service); - this.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); - if (instanceGroupId != null && instanceGroupModelInfo != null) - this.mapNetworkCollectionInstanceGroup(genericVnf, instanceGroupId); } } @@ -584,7 +581,7 @@ public class BBInputSetup implements JavaDelegate { } protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { - org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = this.bbInputSetupUtils + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = bbInputSetupUtils .getAAIInstanceGroup(instanceGroupId); InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup( @@ -635,25 +632,22 @@ public class BBInputSetup implements JavaDelegate { protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) { - boolean foundByName = false; - boolean foundById = false; - for (L3Network network : serviceInstance.getNetworks()) { + L3Network network = null; + for (L3Network networkTemp : serviceInstance.getNetworks()) { if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null - && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { - foundById = true; - this.mapCatalogNetwork(network, modelInfo, service); - } else if (instanceName != null && network.getNetworkName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); - this.mapCatalogNetwork(network, modelInfo, service); + && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + network = networkTemp; + break; } } - if (!foundByName && !foundById + if (network == null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network l3Network = this.createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); - serviceInstance.getNetworks().add(l3Network); - this.mapCatalogNetwork(l3Network, modelInfo, service); + network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(network); + } + if(network != null) { + mapCatalogNetwork(network, modelInfo, service); } } @@ -1452,7 +1446,9 @@ public class BBInputSetup implements JavaDelegate { aaiCollection = aaiCollectionOp.get(); Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); - + NetworkCollectionResourceCustomization collectionResourceCust = + bbInputSetupUtils.getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, collectionResourceCust.getCollectionResource())); Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); Relationships relationships = null; if (relationshipsOp.isPresent()) { @@ -1493,7 +1489,7 @@ public class BBInputSetup implements JavaDelegate { Relationships relationships = relationshipsOp.get(); this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), network.getNetworkPolicies()); - this.mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), + mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), network.getContrailNetworkRouteTableReferences()); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 04f9cdcb86..c2161a4fee 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -142,6 +142,10 @@ public class BBInputSetupMapperLayer { protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule()); + vfModule.setModelInfoVfModule(modelInfoVfModule); return vfModule; } @@ -175,7 +179,7 @@ public class BBInputSetupMapperLayer { protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); - if(instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + if(instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); else modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); @@ -201,6 +205,7 @@ public class BBInputSetupMapperLayer { modelInfoCollection.setDescription(collectionResource.getDescription()); modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID()); return modelInfoCollection; } @@ -461,4 +466,4 @@ public class BBInputSetupMapperLayer { CollectionNetworkResourceCustomization collectionNetworkResourceCust) { return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 14c162935a..4b85538428 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -49,6 +49,7 @@ import org.onap.so.client.db.request.RequestsDbClient; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -127,6 +128,11 @@ public class BBInputSetupUtils { return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); } + public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID( + String collectionCustomizationId) { + return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId); + } + public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); } @@ -389,8 +395,8 @@ public class BBInputSetupUtils { } } - public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vfModuleId, String volumeGroupName) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vfModuleId); + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; @@ -406,4 +412,4 @@ public class BBInputSetupUtils { return Optional.of(volumeGroup); } } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn deleted file mode 100644 index 90722a95f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn +++ /dev/null @@ -1,321 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" 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="CustomE2EGetService" name="CustomE2EGetService" isExecutable="true"> - <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> - <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> - <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:subProcess> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.setSuccessIndicator(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.getServiceObject(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> - <bpmn2:incoming>getUrlNo</bpmn2:incoming> - <bpmn2:incoming>foundYes</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> - <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> - <bpmn2:incoming>obtainById</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> - <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> - <bpmn2:incoming>obtainByName</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> - <bpmn2:incoming>getUrlYes</bpmn2:incoming> - <bpmn2:outgoing>obtainById</bpmn2:outgoing> - <bpmn2:outgoing>obtainByName</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> - <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> - <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> - <bpmn2:outgoing>foundYes</bpmn2:outgoing> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> - </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> - </bpmn2:endEvent> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> - <dc:Bounds x="108" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="126" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> - <dc:Bounds x="228" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> - <di:waypoint xsi:type="dc:Point" x="144" y="282" /> - <di:waypoint xsi:type="dc:Point" x="228" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="177" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> - <dc:Bounds x="372" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="420" y="282" width="72" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> - <di:waypoint xsi:type="dc:Point" x="328" y="282" /> - <di:waypoint xsi:type="dc:Point" x="372" y="281" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="350" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> - <dc:Bounds x="528" y="197" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds x="738" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="311" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> - <dc:Bounds x="820" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> - <di:waypoint xsi:type="dc:Point" x="397" y="256" /> - <di:waypoint xsi:type="dc:Point" x="397" y="170" /> - <di:waypoint xsi:type="dc:Point" x="446" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="397" y="213" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="195" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="668" y="221" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> - <di:waypoint xsi:type="dc:Point" x="788" y="281" /> - <di:waypoint xsi:type="dc:Point" x="820" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="397" y="306" /> - <di:waypoint xsi:type="dc:Point" x="397" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="306" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="400" y="324" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> - <dc:Bounds x="960" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> - <di:waypoint xsi:type="dc:Point" x="920" y="282" /> - <di:waypoint xsi:type="dc:Point" x="960" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="937" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> - <dc:Bounds x="1133" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1151" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> - <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> - <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="152" y="468" width="325" height="169" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> - <dc:Bounds x="176" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="194" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> - <dc:Bounds x="416" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> - <dc:Bounds x="265" y="513" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> - <di:waypoint xsi:type="dc:Point" x="212" y="553" /> - <di:waypoint xsi:type="dc:Point" x="265" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="233" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> - <di:waypoint xsi:type="dc:Point" x="365" y="553" /> - <di:waypoint xsi:type="dc:Point" x="416" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="385" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> - <dc:Bounds x="528" y="59" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> - <dc:Bounds x="446" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="501" y="164" width="53" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> - <dc:Bounds x="646" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="200" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> - <di:waypoint xsi:type="dc:Point" x="471" y="195" /> - <di:waypoint xsi:type="dc:Point" x="471" y="236" /> - <di:waypoint xsi:type="dc:Point" x="528" y="237" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="476" y="207" width="16" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> - <di:waypoint xsi:type="dc:Point" x="471" y="145" /> - <di:waypoint xsi:type="dc:Point" x="471" y="99" /> - <di:waypoint xsi:type="dc:Point" x="528" y="99" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="471" y="115" width="40" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="145" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665" y="99" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="738" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="735" y="125" width="59" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> - <di:waypoint xsi:type="dc:Point" x="696" y="170" /> - <di:waypoint xsi:type="dc:Point" x="738" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="704" y="170" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="763" y="195" /> - <di:waypoint xsi:type="dc:Point" x="763" y="256" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="762" y="205" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> - <di:waypoint xsi:type="dc:Point" x="788" y="170" /> - <di:waypoint xsi:type="dc:Point" x="877" y="171" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="170" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> - <dc:Bounds x="877" y="153" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="895" y="194" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn deleted file mode 100644 index 2015526874..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn +++ /dev/null @@ -1,321 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="GenericGetService" name="GenericGetService" isExecutable="true"> - <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> - <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> - <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:subProcess> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.setSuccessIndicator(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.getServiceObject(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> - <bpmn2:incoming>getUrlNo</bpmn2:incoming> - <bpmn2:incoming>foundYes</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> - <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> - <bpmn2:incoming>obtainById</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> - <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> - <bpmn2:incoming>obtainByName</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> - <bpmn2:incoming>getUrlYes</bpmn2:incoming> - <bpmn2:outgoing>obtainById</bpmn2:outgoing> - <bpmn2:outgoing>obtainByName</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> - <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> - <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> - <bpmn2:outgoing>foundYes</bpmn2:outgoing> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> - </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> - </bpmn2:endEvent> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> - <dc:Bounds x="108" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="126" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> - <dc:Bounds x="228" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> - <di:waypoint xsi:type="dc:Point" x="144" y="282" /> - <di:waypoint xsi:type="dc:Point" x="228" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="177" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> - <dc:Bounds x="372" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="420" y="282" width="72" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> - <di:waypoint xsi:type="dc:Point" x="328" y="282" /> - <di:waypoint xsi:type="dc:Point" x="372" y="281" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="350" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> - <dc:Bounds x="528" y="197" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds x="738" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="311" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> - <dc:Bounds x="820" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> - <di:waypoint xsi:type="dc:Point" x="397" y="256" /> - <di:waypoint xsi:type="dc:Point" x="397" y="170" /> - <di:waypoint xsi:type="dc:Point" x="446" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="397" y="213" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="195" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="668" y="221" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> - <di:waypoint xsi:type="dc:Point" x="788" y="281" /> - <di:waypoint xsi:type="dc:Point" x="820" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="397" y="306" /> - <di:waypoint xsi:type="dc:Point" x="397" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="306" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="400" y="324" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> - <dc:Bounds x="960" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> - <di:waypoint xsi:type="dc:Point" x="920" y="282" /> - <di:waypoint xsi:type="dc:Point" x="960" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="937" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> - <dc:Bounds x="1133" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1151" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> - <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> - <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="152" y="468" width="325" height="169" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> - <dc:Bounds x="176" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="194" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> - <dc:Bounds x="416" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> - <dc:Bounds x="265" y="513" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> - <di:waypoint xsi:type="dc:Point" x="212" y="553" /> - <di:waypoint xsi:type="dc:Point" x="265" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="233" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> - <di:waypoint xsi:type="dc:Point" x="365" y="553" /> - <di:waypoint xsi:type="dc:Point" x="416" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="385" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> - <dc:Bounds x="528" y="59" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> - <dc:Bounds x="446" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="501" y="164" width="53" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> - <dc:Bounds x="646" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="200" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> - <di:waypoint xsi:type="dc:Point" x="471" y="195" /> - <di:waypoint xsi:type="dc:Point" x="471" y="236" /> - <di:waypoint xsi:type="dc:Point" x="528" y="237" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="476" y="207" width="16" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> - <di:waypoint xsi:type="dc:Point" x="471" y="145" /> - <di:waypoint xsi:type="dc:Point" x="471" y="99" /> - <di:waypoint xsi:type="dc:Point" x="528" y="99" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="471" y="115" width="40" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="145" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665" y="99" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="738" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="735" y="125" width="59" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> - <di:waypoint xsi:type="dc:Point" x="696" y="170" /> - <di:waypoint xsi:type="dc:Point" x="738" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="704" y="170" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="763" y="195" /> - <di:waypoint xsi:type="dc:Point" x="763" y="256" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="762" y="205" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> - <di:waypoint xsi:type="dc:Point" x="788" y="170" /> - <di:waypoint xsi:type="dc:Point" x="877" y="171" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="170" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> - <dc:Bounds x="877" y="153" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="895" y="194" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy deleted file mode 100644 index a8c10b1e81..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner - -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName - -/** - * @author sushilma - * @since January 10, 2018 - */ -@RunWith(MockitoJUnitRunner.class) -@Ignore -class CustomE2EGetServiceTest extends MsoGroovyTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Captor - static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - - @Test - public void testObtainServiceInstanceUrlById (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.obtainServiceInstanceUrlById(mockExecution) - Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } - - @Test - public void testObtainServiceInstanceUrlByName (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceName")).thenReturn("1604-MVM-26") - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.obtainServiceInstanceUrlByName(mockExecution) - Mockito.verify(mockExecution, times(8)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } - - @Test - public void testServiceObject (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENGS_resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/1234453") - MockGetServiceInstance("MSO_1610_dev", "MSO-dev-service-type", "1234453", "GenericFlows/getServiceInstance.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.getServiceObject(mockExecution) - Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy deleted file mode 100644 index 49edd813f7..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.core.WorkflowException - -import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.* - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericGetServiceTest { - - def prefix = "GENGS_" - @Captor - ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class); - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Test - public void testGetServiceObject() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') - when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') - when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') - when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - mockData() - GenericGetService obj = new GenericGetService() - obj.getServiceObject(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix", prefix) - Mockito.verify(mockExecution).setVariable(prefix + "getServiceUrl", "http://localhost:8090/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - Mockito.verify(mockExecution).setVariable(prefix + "getServiceResponseCode", 200) - } - - @Test - public void testGetServiceObjectEndpointNull() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') - when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') - when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - mockData() - try { - GenericGetService obj = new GenericGetService() - obj.getServiceObject(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - private void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/.*")) - .willReturn(aResponse() - .withStatus(200).withHeader("Content-Type", "text/xml") - .withBodyFile(""))) - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") - when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - return mockExecution - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy deleted file mode 100644 index 1aef78f0d5..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy +++ /dev/null @@ -1,180 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.core.WorkflowException - -import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericGetVnfTest { - - def prefix = "GENGV_" - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Captor - static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - public void testGetVnfByName() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfByName(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix","GENGV_") - Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf?vnf-name=genricVnf_test&depth=1") - } - - @Test - public void testGetVnfByNameEndpointNull() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - try{ - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfByName(mockExecution) - }catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - @Test - public void testGetVnfById() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfById(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix","GENGV_") - Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf/genricVnf_test?depth=1") - } - - @Test - public void testGetVnfByIdEndpointNull() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - try{ - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfById(mockExecution) - }catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - private static ExecutionEntity setupMock() { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModule") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModule") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModule") - when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModule") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - - private static void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) - .willReturn(aResponse() - .withStatus(200).withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy deleted file mode 100644 index d4ea8ce71f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy +++ /dev/null @@ -1,235 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import static org.mockito.Mockito.* -import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance; - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericPutServiceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - @Test - public void preProcessRequest() { - - - println "************ preProcessRequest ************* " - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - - GenericPutService putServiceInstance= new GenericPutService() - putServiceInstance.preProcessRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26") - // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET") - // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET") - // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - - } - - - @Test - @Ignore - public void putServiceInstance() { - println "************ putServiceInstance ************* " - - WireMock.reset(); - - MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"); - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer.uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("7") - when(mockExecution.getVariable("mso.workflow.default.aai.v7.customer.uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String servicePayload = """<service-instance xmlns="http://org.openecomp.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance>""" as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload) - - String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - - int responseCode = 200 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>""" - - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", true) - } - - @Test - @Ignore - public void putServiceInstance_404() { - - - println "************ putServiceInstance ************* " - - WireMock.reset(); - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer_uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - - verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String serviceInstancepayload = """<service-instance xmlns="http://org.onap.so.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4 - </service-instance>""" as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload) - - String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath) - - int responseCode = 404 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = "" - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index 8d681d721c..80b978e4fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -31,10 +31,10 @@ public class PayloadClientTest { @Test public void upgradeFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing_software_version\":\"existingVersion\",\"new_software_version\":\"newVersion\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("existing-software-version", "existingVersion"); - jsonObject.put("new-software-version", "newVersion"); + jsonObject.put("existing_software_version", "existingVersion"); + jsonObject.put("new_software_version", "newVersion"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -51,7 +51,7 @@ public class PayloadClientTest { public void quiesceTrafficFormatTest() throws Exception { String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("operations-timeout", "operationTimeout"); + jsonObject.put("operations_timeout", "operationTimeout"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -78,4 +78,4 @@ public class PayloadClientTest { assertEquals(payloadResult, payloadClient.get()); } -}
\ No newline at end of file +} 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 355dc15bbf..a821d69754 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 @@ -658,8 +658,8 @@ public class BBInputSetupTest { public void testPopulateObjectsOnAssignAndCreateFlows() throws Exception { String bbName = AssignFlows.SERVICE_INSTANCE.toString(); String instanceName = "instanceName"; - String resourceId = "123"; String vnfType = "vnfType"; + String resourceId = "networkId"; Service service = Mockito.mock(Service.class); ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); RequestDetails requestDetails = Mockito.mock(RequestDetails.class); @@ -675,12 +675,6 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); - doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); - doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); doReturn(modelInfo).when(requestDetails).getModelInfo(); doReturn(requestInfo).when(requestDetails).getRequestInfo(); doReturn(instanceName).when(requestInfo).getInstanceName(); @@ -690,36 +684,41 @@ public class BBInputSetupTest { doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); doReturn(ModelType.network).when(modelInfo).getModelType(); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); + assertEquals("NetworkId populated", true, lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vnf).when(modelInfo).getModelType(); - + resourceId = "vnfId"; + doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); - + resourceId = "volumeGroupId"; + doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + assertEquals("VolumeGroupId populated", true, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vfModule).when(modelInfo).getModelType(); - + resourceId = "vfModuleId"; + doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId)); } @Test @@ -946,7 +945,6 @@ public class BBInputSetupTest { vg.setVolumeGroupName("volumeGroupName"); vg.setVolumeGroupId("volumeGroupId"); vnf.getVolumeGroups().add(vg); - vnf.getVolumeGroups().add(vg); serviceInstance.getVnfs().add(vnf); Service service = mapper.readValue( @@ -962,9 +960,10 @@ public class BBInputSetupTest { aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID"); doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); vnf.getVolumeGroups().clear(); SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); @@ -1023,14 +1022,14 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); doReturn(network2).when(SPY_bbInputSetup).createNetwork(lookupKeyMap, instanceName, resourceId, null); SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @Test @@ -1148,8 +1147,15 @@ public class BBInputSetupTest { String resourceId = "123"; doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId"); + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); - doReturn(null).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup(); + doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); @@ -1157,7 +1163,7 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, @@ -1166,11 +1172,14 @@ public class BBInputSetupTest { resourceId, vnfType, null); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2"); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); - verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + 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); } @Test @@ -1202,7 +1211,14 @@ public class BBInputSetupTest { String resourceId = "123"; doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId"); + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup(); + doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); @@ -1211,20 +1227,24 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null); doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null); + org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId2"); + 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(1)).mapCatalogVnf(vnf2, modelInfo, service); - verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + 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); } @Test @@ -1459,14 +1479,20 @@ public class BBInputSetupTest { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection))); Collection collection = new Collection(); + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); List<InstanceGroup> instanceGroupsList = new ArrayList<>(); InstanceGroup instanceGroup = new InstanceGroup(); instanceGroupsList.add(instanceGroup); - + NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class); + CollectionResource collectionResource = new CollectionResource(); doReturn(collection).when(bbInputSetupMapperLayer) .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class)); doReturn(instanceGroup).when(SPY_bbInputSetup).mapInstanceGroup(isA(AAIResultWrapper.class)); doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any()); + doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + doReturn(collectionResource).when(networkCollectionCust).getCollectionResource(); + doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource); + SPY_bbInputSetup.mapCollection(collections, serviceInstance); assertEquals(collection, serviceInstance.getCollection()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index d576242318..aa883b67a2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -736,7 +736,7 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupName("name123"); expected.get().getVolumeGroup().add(volumeGroup); doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "name123"); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123"); assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); } @@ -745,6 +745,7 @@ public class BBInputSetupUtilsTest { expectedException.expect(Exception.class); String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; VolumeGroup volumeGroup = new VolumeGroup(); @@ -757,18 +758,19 @@ public class BBInputSetupUtilsTest { doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); } @Test public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); assertEquals(actualVolumeGroup, Optional.empty()); } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json index a500e0ba88..4a72cde73a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json @@ -1,5 +1,5 @@ { - "modelUUID":null, + "modelUUID":"modelVersionId", "modelName":null, "modelInvariantUUID":"modelInvariantUUID", "modelVersion":null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json index d87875da81..fc2ade75fb 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json @@ -1,5 +1,5 @@ { - "modelCustomizationUUID":null, + "modelCustomizationUUID":"modelCustomizationUUID", "modelInstanceName":null, "type":"type", "role":"role", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json index 0d00e4d007..e4c8a8f59b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json @@ -12,7 +12,9 @@ "heat-stack-id":"heatStackId", "contrail-service-instance-fqdn":"contrailServiceInstanceFqdn", "module-index":1,"selflink":"selflink", - "model-info-vf-module":null + "model-info-vf-module": { + "is-base-boolean":false + } }], "volume-groups":[], "line-of-business":null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json index 45ca00bd32..a7e2ade10b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json @@ -1,4 +1,6 @@ { + "model-customization-uuid":"modelCustomizationUUID", + "model-version-id":"modelVersionId", "model-invariant-uuid":"modelInvariantUUID", "collection-function":"function", "collection-role":"role", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml deleted file mode 100644 index 7c879879ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml +++ /dev/null @@ -1,23 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <resource-version>testReVer123</resource-version> - <relationship-list> - <relationship> - <related-to>nothing</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml deleted file mode 100644 index 0b5a822b68..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml +++ /dev/null @@ -1,90 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - <generic-vnf> - <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> - <vnf-name>ZRDM1MMSC03</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml deleted file mode 100644 index 0b5a822b68..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml +++ /dev/null @@ -1,90 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - <generic-vnf> - <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> - <vnf-name>ZRDM1MMSC03</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml deleted file mode 100644 index d0fccd80c9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - <search-results xmlns="http://com.aai.inventory"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml deleted file mode 100644 index d0fccd80c9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml +++ /dev/null @@ -1,6 +0,0 @@ - <search-results xmlns="http://com.aai.inventory"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml deleted file mode 100644 index fce47fcd0d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<search-results xmlns="http://org.openecomp.aai.inventory/v11"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>/aai/v11/business/customers/customer/AbcBank/service-subscriptions/service-subscription/ABC-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>/aai/v11/business/customers/customer/XyCorporation/service-subscriptions/service-subscription/XY-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> -</search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml deleted file mode 100644 index e377c70474..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml +++ /dev/null @@ -1,30 +0,0 @@ -<service-instance> - <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> - <resource-version>123456789</resource-version> - <relationship-list> - <relationship> - <related-to>cvlan-tag</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> - <relationship-data> - <relationship-key>cvlan-tag.cvlan-tag</relationship-key> - <relationship-value>2003</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>port-group.interface-id</relationship-key> - <relationship-value>slcp1447vbc.ipag</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vce</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </service-instance>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml deleted file mode 100644 index 52e75d970a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml +++ /dev/null @@ -1,34 +0,0 @@ -<service-subscription xmlns="http://com.aai.inventory"> - <service-type>SDN-ETHERNET-INTERNET</service-type> - <resource-version>1234</resource-version> - <service-instance> - <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> - <resource-version>123456789</resource-version> - <relationship-list> - <relationship> - <related-to>cvlan-tag</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> - <relationship-data> - <relationship-key>cvlan-tag.cvlan-tag</relationship-key> - <relationship-value>2003</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>port-group.interface-id</relationship-key> - <relationship-value>slcp1447vbc.ipag</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vce</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </service-instance> - </service-subscription>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml deleted file mode 100644 index b55d51971d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml +++ /dev/null @@ -1,97 +0,0 @@ -<vce xmlns="http://com.aai.inventory"> - <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-name2>US0112SLCP1VBRT076</vnf-name2> - <vnf-type>esx-vce</vnf-type> - <prov-status>NVTPROV</prov-status> - <orchestration-status>created</orchestration-status> - <resource-version>0000020</resource-version> - <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> - <mso-catalog-key/> - <vpe-id>VPESAT-mtanjrsv126</vpe-id> - <ipv4-oam-address>135.21.249.160</ipv4-oam-address> - <port-groups> - <port-group> - <interface-id>slcp1476vbc.vpe</interface-id> - <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> - <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> - <interface-role>Internet</interface-role> - <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> - <resource-version>0000020</resource-version> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>3012</cvlan-tag> - <resource-version>0000020</resource-version> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - <port-group> - <interface-id>slcp1476vbc.ipag</interface-id> - <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> - <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> - <interface-role>Customer</interface-role> - <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <resource-version>0000020</resource-version> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>2003</cvlan-tag> - <resource-version>0000020</resource-version> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - </port-groups> - <relationship-list> - <relationship> - <related-to>service-instance</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>011216-1602-SDNC001</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vserver</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> - <relationship-data> - <relationship-key>vserver.vserver-id</relationship-key> - <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>complex</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> - <relationship-data> - <relationship-key>complex.physical-location-id</relationship-key> - <relationship-value>MDTWNJ21A4</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>availability-zone</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> - <relationship-data> - <relationship-key>availability-zone.availability-zone-name</relationship-key> - <relationship-value>slcp1-esx-az01</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml deleted file mode 100644 index e5f98bfe33..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml +++ /dev/null @@ -1,92 +0,0 @@ -<vce xmlns="http://com.aai.inventory"> - <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-name2>US0112SLCP1VBRT076</vnf-name2> - <vnf-type>esx-vce</vnf-type> - <prov-status>NVTPROV</prov-status> - <orchestration-status>created</orchestration-status> - <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> - <mso-catalog-key/> - <vpe-id>VPESAT-mtanjrsv126</vpe-id> - <ipv4-oam-address>135.21.249.160</ipv4-oam-address> - <port-groups> - <port-group> - <interface-id>slcp1476vbc.vpe</interface-id> - <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> - <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> - <interface-role>Internet</interface-role> - <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>3012</cvlan-tag> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - <port-group> - <interface-id>slcp1476vbc.ipag</interface-id> - <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> - <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> - <interface-role>Customer</interface-role> - <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>2003</cvlan-tag> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - </port-groups> - <relationship-list> - <relationship> - <related-to>service-instance</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>011216-1602-SDNC001</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vserver</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> - <relationship-data> - <relationship-key>vserver.vserver-id</relationship-key> - <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>complex</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> - <relationship-data> - <relationship-key>complex.physical-location-id</relationship-key> - <relationship-value>MDTWNJ21A4</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>availability-zone</related-to> - <related-link>https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> - <relationship-data> - <relationship-key>availability-zone.availability-zone-name</relationship-key> - <relationship-value>slcp1-esx-az01</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml deleted file mode 100644 index eedbda9343..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml +++ /dev/null @@ -1,11 +0,0 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml deleted file mode 100644 index 66ed8f5758..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<Fault> -<requestError> -<serviceException> -<messageId>SVC3002</messageId> -<text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> -<variables> -<variable>PUTcustomer</variable> -<variable>SubName01</variable> -<variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable> -<variable>ERR.5.4.5105</variable> -</variables> -</serviceException> -</requestError> -</Fault>
\ No newline at end of file |