diff options
Diffstat (limited to 'bpmn')
63 files changed, 1868 insertions, 2487 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index 7e1280729c..841fe9f50e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -9,9 +9,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. @@ -25,295 +25,98 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.db.request.beans.InfraActiveRequests +import org.onap.so.db.request.client.RequestsDbClient import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.onap.so.bpmn.core.UrnPropertiesReader; public class CompleteMsoProcess extends AbstractServiceTaskProcessor { - private static final Logger logger = LoggerFactory.getLogger( CompleteMsoProcess.class); - - String Prefix="CMSO_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - // Complete MSO Request processing - public initializeProcessVariables(DelegateExecution execution){ - - def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - try { - - /* Initialize all the process request variables in this block */ - execution.setVariable("prefix",Prefix) - execution.setVariable("CMSO_request_id","") - execution.setVariable("CMSO_notification-url","") - execution.setVariable("CMSO_mso-bpel-name","") - execution.setVariable("CMSO_request_action","") - execution.setVariable("CMSO_notification-url-Ok", false) - execution.setVariable("CMSO_request_id-Ok", false) - - //updateRequest Adapter process variables - execution.setVariable("CMSO_updateRequestResponse", "") - execution.setVariable("CMSO_updateRequestResponseCode", "") - execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") - - //Set DB adapter variables here - execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "") - execution.setVariable("CMSO_updateInfraRequestDBPayload", "") - execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") - - //Auth variables - execution.setVariable("BasicAuthHeaderValue","") - - //Response variables - execution.setVariable("CompletionHandlerResponse","") - execution.setVariable("CMSO_ErrorResponse", null) - execution.setVariable("CMSO_ResponseCode", "") - - setSuccessIndicator(execution, false) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - } - - public void preProcessRequest (DelegateExecution execution) { - - initializeProcessVariables(execution) - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - // logger.trace("Started CompleteMsoProcess preProcessRequest Method "); - logger.trace('Entered ' + method) - - setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) - - try { - def xml = execution.getVariable("CompleteMsoProcessRequest") - - logger.debug("CompleteMsoProcess Request: " + xml) - logger.debug("Incoming Request is: "+ xml) - - //mso-bpel-name from the incoming request - def msoBpelName = utils.getNodeText(xml,"mso-bpel-name") - execution.setVariable("CMSO_mso-bpel-name",msoBpelName) - - //Check the incoming request type - //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) - if (utils.nodeExists(xml, "request-information")) { - execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS - } - - //Check for rehome indicator - def rehomeIndicator = utils.getNodeText(xml,"rehomeDone") - execution.setVariable("rehomeDone", rehomeIndicator) - - //Check notification-url for the incoming request type - //ACTIVE_REQUESTS may have notificationurl node - //INFRA_ACTIVE_REQUESTS notificationurl node does not exist - def notificationurl = "" - if (utils.nodeExists(xml, "notification-url")) { - notificationurl = utils.getNodeText(xml,"notification-url") - if(notificationurl != null && !notificationurl.isEmpty()) { - execution.setVariable("CMSO_notification-url-Ok", true) - execution.setVariable("CMSO_notification-url",notificationurl) - } - } - - //Check request_id for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) - //For ACTIVE_REQUESTS payload request-id is NOT optional - def request_id = "" - if (utils.nodeExists(xml, "request-id")) { - execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id")) - } - - - // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory - // ACTIVE_REQUEST have "request-action" ... mandatory - if (utils.nodeExists(xml, "request-action")) { - execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action")) - } else if (utils.nodeExists(xml, "action")) { - execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action")) - } - - //Check source for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload source IS optional - //For ACTIVE_REQUESTS payload source is NOT optional - def source = "" - if (utils.nodeExists(xml, "source")) { - execution.setVariable("CMSO_source",utils.getNodeText(xml,"source")) - } - - logger.trace("--> " + execution.getVariable("")) - logger.trace("--> " + execution.getVariable("")) - - // set the DHV/Service Instantiation values if specified in the request - execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id")) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time")) - logger.trace("--> " + execution.getVariable("")) - // this variable is used by the camunda flow to set the Content-Type for the async response - if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") && - execution.getVariable("CMSO_is_json_content").equals("true")) { - execution.setVariable("CMSO_content_type", "application/json") - } else { - execution.setVariable("CMSO_content_type", "text/xml") - } - - logger.trace('Exited ' + method) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logger.debug("Exception Occured During PreProcessRequest: " + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){ - - def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - - def xml = execution.getVariable("CompleteMsoProcessRequest") - - //Get statusMessage if exists - def statusMessage - if(utils.nodeExists(xml, "status-message")){ - statusMessage = utils.getNodeText(xml, "status-message") - }else{ - statusMessage = "Resource Completed Successfully" - } - - //Get instance Id if exist - String idXml = "" - if(utils.nodeExists(xml, "vnfId")){ - idXml = utils.getNodeXml(xml, "vnfId") - }else if(utils.nodeExists(xml, "networkId")){ - idXml = utils.getNodeXml(xml, "networkId") - }else if(utils.nodeExists(xml, "configurationId")){ - idXml = utils.getNodeXml(xml, "configurationId") - }else if(utils.nodeExists(xml, "serviceInstanceId")){ - idXml = utils.getNodeXml(xml, "serviceInstanceId") - }else if(utils.nodeExists(xml, "vfModuleId")){ - idXml = utils.getNodeXml(xml, "vfModuleId") - }else if(utils.nodeExists(xml, "volumeGroupId")){ - idXml = utils.getNodeXml(xml, "volumeGroupId") - }else{ - idXml = "" - } - idXml = utils.removeXmlPreamble(idXml) - idXml = utils.removeXmlNamespaces(idXml) - logger.debug("Incoming Instance Id Xml: " + idXml) - - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>${MsoUtils.xmlEscape(execution.getVariable("CMSO_request_id"))}</requestId> - <lastModifiedBy>${MsoUtils.xmlEscape(execution.getVariable("CMSO_mso-bpel-name"))}</lastModifiedBy> - <statusMessage>${MsoUtils.xmlEscape(statusMessage)}</statusMessage> - <requestStatus>COMPLETE</requestStatus> - <progress>100</progress> - ${idXml} - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope>""" - - execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload) - logger.debug("Outgoing Update Mso Request Payload is: " + payload) - logger.debug("setUpdateDBstatustoSuccessPayload: " + payload) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - logger.trace('Exited ' + method) - } - - public void buildDataError (DelegateExecution execution, String message) { - - def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - try { - - String msoCompletionResponse = """ - <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out> - </sdncadapterworkflow:MsoCompletionResponse> - """.trim() - - // Format Response - def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse) - String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() - logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) - execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) - logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse")) - - exceptionUtil.buildAndThrowWorkflowException(execution, 500, message) - - } catch (BpmnError e) { - logger.debug("Rethrowing MSOWorkflowException") - throw e; - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - } - - public void postProcessResponse (DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - // logger.trace("Started CompleteMsoProcess PostProcessRequest Method "); - try { - - String msoCompletionResponse = """ - <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://ecomp.com/mso/workflow/schema/v1"> - <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out> - </sdncadapterworkflow:MsoCompletionResponse> - """.trim() - - // Format Response - def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse) - String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString) - logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) - execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) - execution.setVariable("CMSO_ResponseCode", "200") - - setSuccessIndicator(execution, true) - - logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse")) - - logger.trace('Exited ' + method) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - } - + private static final Logger logger = LoggerFactory.getLogger(CompleteMsoProcess.class); + + String Prefix="CMSO_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + try { + def xml = execution.getVariable("CompleteMsoProcessRequest") + + logger.debug("CompleteMsoProcess Request: " + xml) + logger.debug("Incoming Request is: "+ xml) + + //mso-bpel-name from the incoming request + def msoBpelName = utils.getNodeText(xml,"mso-bpel-name") + execution.setVariable("CMSO_mso-bpel-name",msoBpelName) + + if (utils.nodeExists(xml, "request-information")) { + throw new BpmnError("500", "FalloutHandler subflow does not support this request type.") + } + + def request_id = "" + if (utils.nodeExists(xml, "request-id")) { + execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id")) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logger.debug("Exception Occured During PreProcessRequest: " + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in preprocess") + } + } + + public void updateInfraRequestDB (DelegateExecution execution){ + try { + + def xml = execution.getVariable("CompleteMsoProcessRequest") + + //Get statusMessage if exists + def statusMessage + if(utils.nodeExists(xml, "status-message")){ + statusMessage = utils.getNodeText(xml, "status-message") + }else{ + statusMessage = "Resource Completed Successfully" + } + + RequestsDbClient dbClient = getDbClient() + + InfraActiveRequests infraRequest = dbClient.getInfraActiveRequests(execution.getVariable("CMSO_request_id"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) + if(infraRequest == null){ + infraRequest = new InfraActiveRequests(); + infraRequest.setRequestId(execution.getVariable("CMSO_request_id")) + } + infraRequest.setLastModifiedBy("BPMN") + infraRequest.setStatusMessage(statusMessage) + infraRequest.setRequestStatus("COMPLETED") + infraRequest.setProgress(100) + + if(utils.nodeExists(xml, "vnfId")){ + infraRequest.setVnfId(utils.getNodeText(xml, "vnfId")) + }else if(utils.nodeExists(xml, "networkId")){ + infraRequest.setNetworkId(utils.getNodeText(xml, "networkId")) + }else if(utils.nodeExists(xml, "configurationId")){ + infraRequest.setConfigurationId(utils.getNodeText(xml, "configurationId")) + }else if(utils.nodeExists(xml, "serviceInstanceId")){ + infraRequest.setServiceInstanceId(utils.getNodeText(xml, "serviceInstanceId")) + }else if(utils.nodeExists(xml, "vfModuleId")){ + infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId")) + }else if(utils.nodeExists(xml, "volumeGroupId")){ + infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId")) + + } + + dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) + + } catch (Exception e) { + logger.error("Internal error while updating request db", e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in update infra request db") + } + } + + protected RequestsDbClient getDbClient(){ + return new RequestsDbClient() + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index ed849755b7..8306f33592 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -9,9 +9,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. @@ -24,376 +24,134 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.db.request.beans.InfraActiveRequests +import org.onap.so.db.request.client.RequestsDbClient import org.onap.so.logger.ErrorCode - +import org.onap.so.bpmn.core.UrnPropertiesReader; import java.text.SimpleDateFormat import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory public class FalloutHandler extends AbstractServiceTaskProcessor { - private static final Logger logger = LoggerFactory.getLogger( FalloutHandler.class); - - String Prefix="FH_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public initializeProcessVariables(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - execution.setVariable("prefix",Prefix) - - //These variables are form the input Message to the BPMN - execution.setVariable("FH_request_id","") - execution.setVariable("FH_request_action","") - execution.setVariable("FH_notification-url","") - execution.setVariable("FH_mso-bpel-name","") - execution.setVariable("FH_ErrorCode", "") - execution.setVariable("FH_ErrorMessage", "") - - execution.setVariable("FH_notification-url-Ok", false) - execution.setVariable("FH_request_id-Ok", false) - - //These variables are for Get Mso Aai Password Adapter - execution.setVariable("FH_deliveryStatus", true) - - //update Response Status to pending ...Adapter variables - execution.setVariable("FH_updateResponseStatusPayload", null) - execution.setVariable("FH_updateResponseStatusResponse", null) - - //update Request Gamma ...Adapter variables - execution.setVariable("FH_updateRequestGammaPayload", "") - execution.setVariable("FH_updateRequestGammaResponse", null) - execution.setVariable("FH_updateRequestGammaResponseCode", null) - - //update Request Infra ...Adapter variables - execution.setVariable("FH_updateRequestInfraPayload", "") - execution.setVariable("FH_updateRequestInfraResponse", null) - execution.setVariable("FH_updateRequestInfraResponseCode", null) - - //assign True to success variable - execution.setVariable("FH_success", true) - - //Set notify status to Failed variable - execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS") - - //Set DB update variable - execution.setVariable("FH_updateRequestPayload", "") - execution.setVariable("FH_updateRequestResponse", null) - execution.setVariable("FH_updateRequestResponseCode", null) - - //Auth variables - execution.setVariable("BasicAuthHeaderValue","") - - //Parameter list - execution.setVariable("FH_parameterList", "") - - //Response variables - execution.setVariable("FalloutHandlerResponse","") - execution.setVariable("FH_ErrorResponse", null) - execution.setVariable("FH_ResponseCode", "") - - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - // Initialize flow variables - initializeProcessVariables(execution) - setSuccessIndicator(execution, false) - - setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) - - try { - def xml = execution.getVariable("FalloutHandlerRequest") - logger.debug(" XML --> " + xml) - logger.debug("FalloutHandler request: " + xml) - - //Check the incoming request type - //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) - if (utils.nodeExists(xml, "request-information")) { - execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS - } - - //Check notification-url for the incoming request type - //ACTIVE_REQUESTS may have notificationurl node - //INFRA_ACTIVE_REQUESTS notificationurl node does not exist - def notificationurl = "" - if (utils.nodeExists(xml, "notification-url")) { - notificationurl = utils.getNodeText(xml,"notification-url") - if(notificationurl != null && !notificationurl.isEmpty()) { - logger.debug("********** Incoming notification Url is: " + notificationurl); - execution.setVariable("FH_notification-url-Ok", true) - execution.setVariable("FH_notification-url",notificationurl) - } - } - - //Check request_id for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) - //For ACTIVE_REQUESTS payload request-id is NOT optional - def request_id = "" - if (utils.nodeExists(xml, "request-id")) { - execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) - } - logger.debug("FH_request_id: " + execution.getVariable("FH_request_id")) - - // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory - // ACTIVE_REQUEST have "request-action" ... mandatory - if (utils.nodeExists(xml, "request-action")) { - execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action")) - } else if (utils.nodeExists(xml, "action")) { - execution.setVariable("FH_request_action",utils.getNodeText(xml,"action")) - } - - - //Check source for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload source IS optional - //For ACTIVE_REQUESTS payload source is NOT optional - def source = "" - if (utils.nodeExists(xml, "source")) { - execution.setVariable("FH_source",utils.getNodeText(xml,"source")) - } - - //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. - def errorCode = "" - if (utils.nodeExists(xml, "ErrorCode")) { - errorCode = utils.getNodeText(xml,"ErrorCode") - if(errorCode != null && !errorCode.isEmpty()) { - execution.setVariable("FH_ErrorCode", errorCode) - } - } - logger.debug("FH_ErrorCode: " + errorCode) - - //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. - def errorMessage = "" - if (utils.nodeExists(xml, "ErrorMessage")) { - errorCode = utils.getNodeText(xml,"ErrorMessage") - if(errorCode != null && !errorCode.isEmpty()) { - errorCode = errorCode - execution.setVariable("FH_ErrorMessage", errorCode) - } - } - - //Check for Parameter List - if (utils.nodeExists(xml, "parameter-list")) { - def parameterList = utils.getNodeXml(xml, "parameter-list", false) - execution.setVariable("FH_parameterList", parameterList) - } - - logger.trace("--> " + execution.getVariable("")) - logger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok")) - - // set the DHV/Service Instantiation values if specified in the request - execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id")) - logger.trace("--> " + execution.getVariable("")) - execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time")) - logger.trace("--> " + execution.getVariable("")) - // this variable is used by the camunda flow to set the Content-Type for the async response - if (execution.getVariable("FH_is_srv_inst_req").equals("true") && - execution.getVariable("FH_is_json_content").equals("true")) { - execution.setVariable("FH_content_type", "application/json") - } else { - execution.setVariable("FH_content_type", "text/xml") - } - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - logger.debug("OUTOF --> Initialize Variables Fallout Handler #########"); - } - - public String updateRequestPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage> - <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode> - <status>FAILED</status> - <responseStatus>${MsoUtils.xmlEscape(execution.getVariable("FH_NOTIFY_STATUS"))}</responseStatus> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - logger.debug("updateRequestPayload: " + payload) - execution.setVariable("FH_updateRequestPayload", payload) - return execution.getVariable("FH_updateRequestPayload") - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateRequestInfraPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <statusMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</statusMessage> - <requestStatus>FAILED</requestStatus> - <progress>100</progress> - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - execution.setVariable("FH_updateRequestInfraPayload", payload) - logger.debug("updateRequestInfraPayload: " + payload) - return execution.getVariable("FH_updateRequestInfraPayload") - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateRequestGammaPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${UrnPropertiesReader.getVariable("mso.default.adapter.namespace", execution)}/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage> - <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode> - <status>FAILED</status> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - execution.setVariable("FH_updateRequestGammaPayload", payload) - logger.debug("updateRequestGammaPayload: " + payload) - return execution.getVariable("FH_updateRequestGammaPayload") - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateResponseStatusPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateResponseStatus> - <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <responseStatus>SENDING_FINAL_NOTIFY</responseStatus> - </req:updateResponseStatus> - </soapenv:Body> - </soapenv:Envelope> - """ - - execution.setVariable("FH_updateResponseStatusPayload", payload) - logger.debug("updateResponseStatusPayload: " + payload) - return execution.getVariable("FH_updateResponseStatusPayload") - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) { - def method = getClass().getSimpleName() + '.buildDBWorkflowException(' + - 'execution=' + execution.getId() + - ', responseCodeVariable=' + responseCodeVariable + ')' - logger.trace('Entered ' + method) - - try { - def responseCode = execution.getVariable(responseCodeVariable) - // If the HTTP response code was null, it means a connection fault occurred (a java exception) - def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response" - def errorCode = responseCode == null ? 7000 : 7020 - // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - /** - * Used to create a workflow response in success and failure cases. - */ - public void postProcessResponse (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' - logger.trace('Entered ' + method) - - try { - Boolean success = (Boolean) execution.getVariable("FH_success") - String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; - - String falloutHandlerResponse = """ + private static final Logger logger = LoggerFactory.getLogger(FalloutHandler.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + logger.trace('Entered ' + method) + + execution.setVariable("FH_success", true) + + try { + def xml = execution.getVariable("FalloutHandlerRequest") + logger.debug("FalloutHandler request: " + xml) + + if (utils.nodeExists(xml, "request-information")) { + throw new BpmnError("500", "FalloutHandler subflow does not support this request type.") + } + + //Check request_id for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) + //For ACTIVE_REQUESTS payload request-id is NOT optional + def request_id = "" + if (utils.nodeExists(xml, "request-id")) { + execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) + } + logger.debug("FH_request_id: " + execution.getVariable("FH_request_id")) + + //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + def errorCode = "500" + if (utils.nodeExists(xml, "ErrorCode")) { + if(errorCode != null && !errorCode.isEmpty()) { + errorCode = utils.getNodeText(xml,"ErrorCode") + } + } + execution.setVariable("FH_ErrorCode", errorCode) + + //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + String errorMessage = "Internal Error occured in MSO, unable to determine error message" + if (utils.nodeExists(xml, "ErrorMessage")) { + if(errorCode != null && !errorCode.isEmpty()) { + errorMessage = utils.getNodeText(xml,"ErrorMessage") + } + } + execution.setVariable("FH_ErrorMessage", errorMessage) + + //Check for Parameter List + if (utils.nodeExists(xml, "parameter-list")) { + def parameterList = utils.getNodeXml(xml, "parameter-list", false) + execution.setVariable("FH_parameterList", parameterList) + } + + + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + } + + public String updateInfraRequestDB(DelegateExecution execution){ + try { + RequestsDbClient client = getDbClient() + InfraActiveRequests infraRequest = client.getInfraActiveRequests(execution.getVariable("FH_request_id"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) + if(infraRequest == null){ + infraRequest = new InfraActiveRequests(); + infraRequest.setRequestId(execution.getVariable("CMSO_request_id")) + } + infraRequest.setLastModifiedBy("BPMN") + infraRequest.setStatusMessage(MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))) + infraRequest.setRequestStatus("FAILED") + infraRequest.setProgress(100) + client.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) + } catch (Exception e) { + execution.setVariable("FH_success", false) + logger.error("Exception Occured while updating infra request db", e) + } + } + + /** + * Used to create a workflow response in success and failure cases. + */ + public void postProcessResponse (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' + logger.trace('Entered ' + method) + + try { + Boolean success = (Boolean) execution.getVariable("FH_success") + String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; + + String falloutHandlerResponse = """ <workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> <workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out> </workflow:FalloutHandlerResponse> """ - falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) - logger.debug("FalloutHandler Response: " + falloutHandlerResponse); + falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) + + execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) + execution.setVariable("WorkflowResponse", falloutHandlerResponse) + execution.setVariable("FH_ResponseCode", success ? "200" : "500") + setSuccessIndicator(execution, success) - execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) - execution.setVariable("WorkflowResponse", falloutHandlerResponse) - execution.setVariable("FH_ResponseCode", success ? "200" : "500") - setSuccessIndicator(execution, success) + logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + } + } - logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) - } catch (Exception e) { - // Do NOT throw WorkflowException! - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - } - } + protected RequestsDbClient getDbClient(){ + return new RequestsDbClient() + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index c98c9ad5da..d9356306b7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -179,7 +179,7 @@ public class BpmnRestClient { logger.trace("request body is {}", jsonReq); } catch (Exception e) { logger.error(LoggingAnchor.FIVE, MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + ErrorCode.BusinessProcessError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } 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 763f163a2b..3f664cb821 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 @@ -257,15 +257,30 @@ public class BBInputSetup implements JavaDelegate { aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); } Service service = null; + boolean isReplace = false; if (aaiServiceInstance != null) { - service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + if (requestAction.equalsIgnoreCase("replaceInstance")) { + RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { + service = bbInputSetupUtils + .getCatalogServiceByModelUUID(relatedInstance.getModelInfo().getModelVersionId()); + isReplace = true; + } + } + } + } else { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } } if (aaiServiceInstance != null && service != null) { ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); this.populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType, executeBB.getBuildingBlock().getKey(), - executeBB.getConfigurationResourceKeys()); + executeBB.getConfigurationResourceKeys(), isReplace); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { @@ -337,7 +352,7 @@ public class BBInputSetup implements JavaDelegate { protected void populateObjectsOnAssignAndCreateFlows(String requestId, RequestDetails requestDetails, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType, String configurationKey, - ConfigurationResourceKeys configurationResourceKeys) throws Exception { + ConfigurationResourceKeys configurationResourceKeys, boolean isReplace) throws Exception { ModelInfo modelInfo = requestDetails.getModelInfo(); String instanceName = requestDetails.getRequestInfo().getInstanceName(); String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); @@ -369,7 +384,7 @@ public class BBInputSetup implements JavaDelegate { } else { lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); this.populateVfModule(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); + relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration(), isReplace); } } else if (modelType.equals(ModelType.instanceGroup)) { lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId); @@ -501,13 +516,18 @@ public class BBInputSetup implements JavaDelegate { protected void populateVfModule(String requestId, 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 { + CloudConfiguration cloudConfiguration, boolean isReplace) throws Exception { + String replaceVnfModelCustomizationUUID = null; String vnfModelCustomizationUUID = null; if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + if (isReplace) { + replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } else { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } } if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId()); @@ -542,12 +562,20 @@ public class BBInputSetup implements JavaDelegate { .getModelCustomizationId(); ModelInfo modelInfoVfModule = new ModelInfo(); modelInfoVfModule.setModelCustomizationId(vfModuleCustId); - mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); + if (isReplace) { + mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, replaceVnfModelCustomizationUUID); + } else { + mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); + } } if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); vnf.getVfModules().add(vfModule); - mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + if (isReplace) { + mapCatalogVfModule(vfModule, modelInfo, service, replaceVnfModelCustomizationUUID); + } else { + mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } } if (vfModule != null) { updateInstanceName(requestId, ModelType.vfModule, vfModule.getVfModuleName()); @@ -1429,7 +1457,7 @@ public class BBInputSetup implements JavaDelegate { cloudConfig.setCloudOwner(cloudRegion.getCloudOwner()); this.populateVfModule(executeBB.getRequestId(), modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, vfModules.getInstanceName(), vfModules.getInstanceParams(), - cloudConfig); + cloudConfig, false); } } else if (bbName.contains(NETWORK)) { networks = findNetworksByKey(key, resources); diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 63c867f3c7..72bed98a5f 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" 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="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -10,8 +10,8 @@ preProcessRequestData.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ExclusiveGateway_1r258d4" /> - <bpmn2:startEvent id="StartEvent_1" name="Start With message"> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ScriptTask_3" /> + <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_2" /> </bpmn2:startEvent> @@ -34,136 +34,18 @@ preProcessRequestData.preProcessRequest(execution) </bpmn2:startEvent> <bpmn2:sequenceFlow id="SequenceFlow_1i1h3il" sourceRef="startEventExceptionCompleteMSO" targetRef="endEventExceptionCompleteMSO" /> </bpmn2:subProcess> - <bpmn2:endEvent id="EndEvent_4"> - <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_5" errorRef="Error_3" /> - </bpmn2:endEvent> - <bpmn2:scriptTask id="ScriptTask_3" name="Prepare Infra Update DB Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_127i45q</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:scriptTask id="ScriptTask_3" name=" MSO Update (infra active req) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1oes9qv</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def completeMsoProcess = new CompleteMsoProcess() -completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ScriptTask_3" targetRef="updateInfraRequest" /> - <bpmn2:serviceTask id="updateInfraRequest" name="Update Infra DB status to SUCCESS"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> - <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("CMSO_setUpdateDBstatustoSuccessPayload")}]]></camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> - <camunda:entry key="X-ONAP-RequestID">#{CMSO_request_id}</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CMSO_updateRequestResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter> - <camunda:outputParameter name="CMSO_updateRequestResponseCode">${statusCode}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>soap-http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="updateInfraRequest" targetRef="ExclusiveGateway_7" /> - <bpmn2:scriptTask id="BuildErrorMessage" name="Build Error Message" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_0mipf25</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - <bpmn2:script><![CDATA[//println "INSIDE --> Build Error Message @@@@" -//println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse") -import org.onap.so.bpmn.common.scripts.* -def buildDataErrorMessage = new CompleteMsoProcess() -buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB status to SUCCESS -- Failed")]]></bpmn2:script> +completeMsoProcess.updateInfraRequestDB(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="BuildErrorMessage" targetRef="EndEvent_4" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_7" default="SequenceFlow_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_03z8rch</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ExclusiveGateway_7" targetRef="BuildErrorMessage" /> - <bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest"> - <bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> - </bpmn2:boundaryEvent> <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_1pzb94j</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1oes9qv</bpmn2:incoming> <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2" /> </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0mipf25" name="Connect Fault" sourceRef="BoundaryEvent_7" targetRef="BuildErrorMessage" /> - <bpmn2:callActivity id="CallActivity_101qf6x" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> - <bpmn2:extensionElements> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:in variables="all" /> - <camunda:out variables="all" /> - <camunda:in businessKey="#{execution.processBusinessKey}" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_13qdn1s" sourceRef="CallActivity_101qf6x" targetRef="ParallelGateway_7" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Active Request?" default="SequenceFlow_1dptl35"> - <bpmn2:incoming>SequenceFlow_067veaf</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_81</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1dptl35</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:exclusiveGateway id="ParallelGateway_7"> - <bpmn2:incoming>SequenceFlow_1dptl35</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_13qdn1s</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1hpvwyt</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_81" name="Yes" sourceRef="ExclusiveGateway_3" targetRef="CallActivity_101qf6x"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_notification-url-Ok") ==true || execution.getVariable("CMSO_request_id-Ok") ==true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_1dptl35" sourceRef="ExclusiveGateway_3" targetRef="ParallelGateway_7" /> - <bpmn2:parallelGateway id="ExclusiveGateway_1r258d4"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_067veaf</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0xe5zck</bpmn2:outgoing> - </bpmn2:parallelGateway> - <bpmn2:parallelGateway id="ExclusiveGateway_019d74x"> - <bpmn2:incoming>SequenceFlow_12he9a1</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1hpvwyt</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1g8ig3h</bpmn2:outgoing> - </bpmn2:parallelGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1g8ig3h" sourceRef="ExclusiveGateway_019d74x" targetRef="ScriptTask_0vyk0lo" /> - <bpmn2:sequenceFlow id="SequenceFlow_067veaf" sourceRef="ExclusiveGateway_1r258d4" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_08yqzk9" name="Infra Check Check" default="SequenceFlow_1ffkc0n"> - <bpmn2:incoming>SequenceFlow_0xe5zck</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_127i45q</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1ffkc0n</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_0xe5zck" sourceRef="ExclusiveGateway_1r258d4" targetRef="ExclusiveGateway_08yqzk9" /> - <bpmn2:sequenceFlow id="SequenceFlow_127i45q" sourceRef="ExclusiveGateway_08yqzk9" targetRef="ScriptTask_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_request_id-Ok") ==false}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="ExclusiveGateway_1utv1g8"> - <bpmn2:incoming>SequenceFlow_03z8rch</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1ffkc0n</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_12he9a1</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_03z8rch" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1utv1g8"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_updateRequestResponseCode")==200}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_1ffkc0n" sourceRef="ExclusiveGateway_08yqzk9" targetRef="ExclusiveGateway_1utv1g8" /> - <bpmn2:sequenceFlow id="SequenceFlow_12he9a1" sourceRef="ExclusiveGateway_1utv1g8" targetRef="ExclusiveGateway_019d74x" /> - <bpmn2:sequenceFlow id="SequenceFlow_1hpvwyt" sourceRef="ParallelGateway_7" targetRef="ExclusiveGateway_019d74x" /> - <bpmn2:scriptTask id="ScriptTask_0vyk0lo" name="Prepare Response" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1g8ig3h</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1pzb94j</bpmn2:outgoing> - <bpmn2:script><![CDATA[println "INSIDE --> Complete MSO Process Done SUCCESSFULLY" -import org.onap.so.bpmn.common.scripts.* -def postProcessResponseData = new CompleteMsoProcess() -postProcessResponseData.postProcessResponse(execution) -println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1pzb94j" sourceRef="ScriptTask_0vyk0lo" targetRef="EndEvent_1" /> + <bpmn2:sequenceFlow id="SequenceFlow_1oes9qv" sourceRef="ScriptTask_3" targetRef="EndEvent_1" /> </bpmn2:process> <bpmn2:message id="Message_2" name="CompleteMsoProcessRequest" /> <bpmn2:error id="Error_3" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -171,254 +53,64 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CompleteMsoProcess"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_41" bpmnElement="StartEvent_1"> - <dc:Bounds x="67" y="297" width="36" height="36" /> + <dc:Bounds x="103" y="156" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="94" y="338" width="49" height="25" /> + <dc:Bounds x="131" y="197" width="47" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_34" bpmnElement="preProcessRequest"> - <dc:Bounds x="167" y="275" width="100" height="80" /> + <dc:Bounds x="293" y="134" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_34" targetElement="ParallelGateway_1domt5l_di"> - <di:waypoint xsi:type="dc:Point" x="267" y="316" /> - <di:waypoint xsi:type="dc:Point" x="322" y="316" /> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_34" targetElement="_BPMNShape_ScriptTask_88"> + <di:waypoint xsi:type="dc:Point" x="393" y="174" /> + <di:waypoint xsi:type="dc:Point" x="440" y="174" /> <bpmndi:BPMNLabel> - <dc:Bounds x="295" y="301" width="0" height="0" /> + <dc:Bounds x="371.5" y="159" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_StartEvent_41" targetElement="_BPMNShape_ScriptTask_34"> - <di:waypoint xsi:type="dc:Point" x="103" y="315" /> - <di:waypoint xsi:type="dc:Point" x="167" y="315" /> + <di:waypoint xsi:type="dc:Point" x="139" y="174" /> + <di:waypoint xsi:type="dc:Point" x="293" y="174" /> <bpmndi:BPMNLabel> - <dc:Bounds x="135" y="300" width="0" height="0" /> + <dc:Bounds x="171" y="159" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_51" bpmnElement="updateInfraRequest"> - <dc:Bounds x="657" y="451" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_13" bpmnElement="subProcessExceptionCompleteMSO" isExpanded="true"> - <dc:Bounds x="171" y="709" width="427" height="169" /> + <dc:Bounds x="208" y="407" width="427" height="169" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_110" bpmnElement="endEventExceptionCompleteMSO"> - <dc:Bounds x="471" y="776" width="36" height="36" /> + <dc:Bounds x="508" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="489" y="817" width="0" height="0" /> + <dc:Bounds x="481" y="515" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_51" bpmnElement="startEventExceptionCompleteMSO"> - <dc:Bounds x="219" y="776" width="36" height="36" /> + <dc:Bounds x="256" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="237" y="817" width="0" height="0" /> + <dc:Bounds x="229" y="515" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_63" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true"> - <dc:Bounds x="816" y="465" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="841" y="520" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_51" targetElement="_BPMNShape_ExclusiveGateway_63"> - <di:waypoint xsi:type="dc:Point" x="757" y="491" /> - <di:waypoint xsi:type="dc:Point" x="816" y="490" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="942" y="534" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_111" bpmnElement="EndEvent_4"> - <dc:Bounds x="953" y="578" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="971" y="619" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_76" bpmnElement="BuildErrorMessage"> - <dc:Bounds x="792" y="556" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ExclusiveGateway_63" targetElement="_BPMNShape_ScriptTask_76"> - <di:waypoint xsi:type="dc:Point" x="841" y="515" /> - <di:waypoint xsi:type="dc:Point" x="842" y="556" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="886" y="342" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_76" targetElement="_BPMNShape_EndEvent_111"> - <di:waypoint xsi:type="dc:Point" x="892" y="596" /> - <di:waypoint xsi:type="dc:Point" x="953" y="596" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="923" y="596" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_128" bpmnElement="EndEvent_1"> - <dc:Bounds x="1270" y="297" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1288" y="338" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_29" bpmnElement="BoundaryEvent_7"> - <dc:Bounds x="686" y="513" width="36" height="36" /> + <dc:Bounds x="699" y="156" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="979" y="395" width="0" height="0" /> + <dc:Bounds x="672" y="197" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_88" bpmnElement="ScriptTask_3"> - <dc:Bounds x="506" y="451" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_88" targetElement="_BPMNShape_ScriptTask_51"> - <di:waypoint xsi:type="dc:Point" x="606" y="491" /> - <di:waypoint xsi:type="dc:Point" x="657" y="491" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="626" y="515" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0mipf25_di" bpmnElement="SequenceFlow_0mipf25"> - <di:waypoint xsi:type="dc:Point" x="704" y="549" /> - <di:waypoint xsi:type="dc:Point" x="704" y="596" /> - <di:waypoint xsi:type="dc:Point" x="792" y="596" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="623" y="563" width="68" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_101qf6x_di" bpmnElement="CallActivity_101qf6x"> - <dc:Bounds x="633" y="186" width="100" height="80" /> + <dc:Bounds x="440" y="134" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_13qdn1s_di" bpmnElement="SequenceFlow_13qdn1s"> - <di:waypoint xsi:type="dc:Point" x="733" y="226" /> - <di:waypoint xsi:type="dc:Point" x="888" y="226" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="811" y="211" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1i1h3il_di" bpmnElement="SequenceFlow_1i1h3il"> - <di:waypoint xsi:type="dc:Point" x="255" y="794" /> - <di:waypoint xsi:type="dc:Point" x="471" y="794" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="363" y="779" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_60" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> - <dc:Bounds x="394" y="201" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="326" y="196" width="80" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_9" bpmnElement="ParallelGateway_7" isMarkerVisible="true"> - <dc:Bounds x="888" y="201" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="913" y="256" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_82" bpmnElement="SequenceFlow_81"> - <di:waypoint xsi:type="dc:Point" x="444" y="226" /> - <di:waypoint xsi:type="dc:Point" x="633" y="226" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="552" y="234" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1dptl35_di" bpmnElement="SequenceFlow_1dptl35"> - <di:waypoint xsi:type="dc:Point" x="419" y="251" /> - <di:waypoint xsi:type="dc:Point" x="419" y="333" /> - <di:waypoint xsi:type="dc:Point" x="913" y="333" /> - <di:waypoint xsi:type="dc:Point" x="913" y="251" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="448" y="273" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_1domt5l_di" bpmnElement="ExclusiveGateway_1r258d4"> - <dc:Bounds x="322" y="291" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="347" y="341" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_04tefv6_di" bpmnElement="ExclusiveGateway_019d74x"> - <dc:Bounds x="999" y="290" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1024" y="340" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1g8ig3h_di" bpmnElement="SequenceFlow_1g8ig3h"> - <di:waypoint xsi:type="dc:Point" x="1049" y="315" /> - <di:waypoint xsi:type="dc:Point" x="1104" y="315" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1077" y="300" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_067veaf_di" bpmnElement="SequenceFlow_067veaf"> - <di:waypoint xsi:type="dc:Point" x="347" y="291" /> - <di:waypoint xsi:type="dc:Point" x="347" y="226" /> - <di:waypoint xsi:type="dc:Point" x="394" y="226" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="362" y="258.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_08yqzk9_di" bpmnElement="ExclusiveGateway_08yqzk9" isMarkerVisible="true"> - <dc:Bounds x="394" y="466" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="390" y="516" width="57" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xe5zck_di" bpmnElement="SequenceFlow_0xe5zck"> - <di:waypoint xsi:type="dc:Point" x="347" y="341" /> - <di:waypoint xsi:type="dc:Point" x="347" y="491" /> - <di:waypoint xsi:type="dc:Point" x="394" y="491" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="362" y="416" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_127i45q_di" bpmnElement="SequenceFlow_127i45q"> - <di:waypoint xsi:type="dc:Point" x="444" y="491" /> - <di:waypoint xsi:type="dc:Point" x="473" y="491" /> - <di:waypoint xsi:type="dc:Point" x="473" y="491" /> - <di:waypoint xsi:type="dc:Point" x="506" y="491" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="488" y="491" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1utv1g8_di" bpmnElement="ExclusiveGateway_1utv1g8" isMarkerVisible="true"> - <dc:Bounds x="999" y="391" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1024" y="441" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_03z8rch_di" bpmnElement="SequenceFlow_03z8rch"> - <di:waypoint xsi:type="dc:Point" x="866" y="490" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="490" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="441" /> + <di:waypoint xsi:type="dc:Point" x="292" y="492" /> + <di:waypoint xsi:type="dc:Point" x="508" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="945" y="475" width="0" height="0" /> + <dc:Bounds x="355" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ffkc0n_di" bpmnElement="SequenceFlow_1ffkc0n"> - <di:waypoint xsi:type="dc:Point" x="419" y="466" /> - <di:waypoint xsi:type="dc:Point" x="419" y="416" /> - <di:waypoint xsi:type="dc:Point" x="999" y="416" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="441" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_12he9a1_di" bpmnElement="SequenceFlow_12he9a1"> - <di:waypoint xsi:type="dc:Point" x="1024" y="391" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="367" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="367" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="340" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1039" y="367" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1hpvwyt_di" bpmnElement="SequenceFlow_1hpvwyt"> - <di:waypoint xsi:type="dc:Point" x="938" y="226" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="226" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="290" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="981" y="211" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0vyk0lo_di" bpmnElement="ScriptTask_0vyk0lo"> - <dc:Bounds x="1104" y="275" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1pzb94j_di" bpmnElement="SequenceFlow_1pzb94j"> - <di:waypoint xsi:type="dc:Point" x="1204" y="315" /> - <di:waypoint xsi:type="dc:Point" x="1270" y="315" /> + <bpmndi:BPMNEdge id="SequenceFlow_1oes9qv_di" bpmnElement="SequenceFlow_1oes9qv"> + <di:waypoint xsi:type="dc:Point" x="540" y="174" /> + <di:waypoint xsi:type="dc:Point" x="699" y="174" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1237" y="290" width="0" height="0" /> + <dc:Bounds x="619.5" y="153" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index 6914e7575f..0c7a8ac063 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -1,178 +1,37 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" 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="FalloutHandler" name="Fallout Handler" isExecutable="true"> - <bpmn2:parallelGateway id="ParallelGateway_1"> - <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> - </bpmn2:parallelGateway> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_1" /> - <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_6" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Notification URL exists?" default="SequenceFlow_23"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="yes" sourceRef="ExclusiveGateway_1" targetRef="Task_0ixuwt5"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_notification-url-Ok") ==true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_23" name="no" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_4" /> <bpmn2:scriptTask id="ScriptTask_8" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1kx7ea5</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def preProcessRequestData = new FalloutHandler() preProcessRequestData.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ScriptTask_8" targetRef="ParallelGateway_1" /> - <bpmn2:startEvent id="StartEvent_1" name="Start"> + <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> </bpmn2:startEvent> <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_8" /> - <bpmn2:parallelGateway id="ParallelGateway_6"> - <bpmn2:incoming>SequenceFlow_37</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - </bpmn2:parallelGateway> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ParallelGateway_6" targetRef="ScriptTask_2" /> <bpmn2:scriptTask id="ScriptTask_2" name="Post Process Response" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1u8shdz</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def falloutHandler = new FalloutHandler() falloutHandler.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_2" targetRef="EndEvent_6" /> - <bpmn2:exclusiveGateway id="ParallelGateway_4"> - <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_0m7gwor</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="ParallelGateway_4" targetRef="ParallelGateway_6" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_6" default="SequenceFlow_26"> - <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="ExclusiveGateway_6" targetRef="ServiceTask_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_request_id-Ok") ==true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="ExclusiveGateway_6" targetRef="ServiceTask_2" /> - <bpmn2:serviceTask id="ServiceTask_3" name="Update Request Gamma"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.db.att-endpoint", execution)}]]></camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> - <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload"> - <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Gamma" -import org.onap.so.bpmn.common.scripts.* -def updateRequestGamma= new FalloutHandler() -return updateRequestGamma.updateRequestGammaPayload(execution)]]></camunda:script> - </camunda:inputParameter> - <camunda:outputParameter name="FH_updateRequestGammaResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter> - <camunda:outputParameter name="FH_updateRequestGammaResponseCode">${statusCode}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>soap-http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="ServiceTask_3" targetRef="ExclusiveGateway_7" /> - <bpmn2:boundaryEvent id="BoundaryEvent_2" name="Connect Fault" attachedToRef="ServiceTask_3"> - <bpmn2:outgoing>SequenceFlow_72</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89" errorRef="Error_2" /> - </bpmn2:boundaryEvent> - <bpmn2:exclusiveGateway id="ParallelGateway_5"> - <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_37</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_37" name="" sourceRef="ParallelGateway_5" targetRef="ParallelGateway_6" /> - <bpmn2:endEvent id="EndEvent_6" name="Normal End"> + <bpmn2:endEvent id="EndEvent_6"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_72" name="" sourceRef="BoundaryEvent_2" targetRef="ScriptTask_6" /> - <bpmn2:scriptTask id="ScriptTask_6" name="Build Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_72</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_79</bpmn2:outgoing> + <bpmn2:scriptTask id="ScriptTask_6" name=" MSO Update (infra active req) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1kx7ea5</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1u8shdz</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def falloutHandler = new FalloutHandler() -falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestGammaResponseCode")]]></bpmn2:script> +falloutHandler.updateInfraRequestDB(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_79" name="" sourceRef="ScriptTask_6" targetRef="EndEvent_13" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_7" name="Update Success?" default="SequenceFlow_31"> - <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ExclusiveGateway_7" targetRef="ScriptTask_6" /> - <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ExclusiveGateway_7" targetRef="ParallelGateway_5"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_updateRequestGammaResponseCode")==200}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_7" name="Build Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_80</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_73</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def falloutHandler = new FalloutHandler() -falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraResponseCode")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_73" name="" sourceRef="ScriptTask_7" targetRef="EndEvent_14" /> - <bpmn2:serviceTask id="ServiceTask_2" name="Update Request Infra"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> - <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload"> - <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Infra" -import org.onap.so.bpmn.common.scripts.* -def updateRequestInfra= new FalloutHandler() -return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:script> - </camunda:inputParameter> - <camunda:outputParameter name="FH_updateRequestInfraResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter> - <camunda:outputParameter name="FH_updateRequestInfraResponseCode">${statusCode}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>soap-http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_30</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_30" name="" sourceRef="ServiceTask_2" targetRef="ExclusiveGateway_8" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_8" name="Update Success?" default="SequenceFlow_32"> - <bpmn2:incoming>SequenceFlow_30</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_7" /> - <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ExclusiveGateway_8" targetRef="ParallelGateway_5"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_updateRequestInfraResponseCode")==200}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:boundaryEvent id="BoundaryEvent_3" name="Connect Fault" attachedToRef="ServiceTask_2"> - <bpmn2:outgoing>SequenceFlow_80</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> - </bpmn2:boundaryEvent> - <bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" /> <bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true"> <bpmn2:scriptTask id="ScriptTask_4" name="Handle Event" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1ko8ggw</bpmn2:incoming> @@ -200,345 +59,94 @@ execution.setVariable("FH_WorkflowException", wfe)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1ko8ggw" sourceRef="StartEvent_2" targetRef="ScriptTask_4" /> <bpmn2:sequenceFlow id="SequenceFlow_1pm9r7h" sourceRef="ScriptTask_4" targetRef="EndEvent_2" /> </bpmn2:subProcess> - <bpmn2:endEvent id="EndEvent_14"> - <bpmn2:incoming>SequenceFlow_73</bpmn2:incoming> - <bpmn2:terminateEventDefinition /> - </bpmn2:endEvent> - <bpmn2:endEvent id="EndEvent_13"> - <bpmn2:incoming>SequenceFlow_79</bpmn2:incoming> - <bpmn2:terminateEventDefinition /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0m7gwor" sourceRef="Task_0ixuwt5" targetRef="ParallelGateway_4" /> - <bpmn2:callActivity id="Task_0ixuwt5" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> - <bpmn2:extensionElements> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:in variables="all" /> - <camunda:out variables="all" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0m7gwor</bpmn2:outgoing> - </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1kx7ea5" sourceRef="ScriptTask_8" targetRef="ScriptTask_6" /> + <bpmn2:sequenceFlow id="SequenceFlow_1u8shdz" sourceRef="ScriptTask_6" targetRef="ScriptTask_2" /> </bpmn2:process> <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="FalloutHandler"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_52" bpmnElement="StartEvent_1"> - <dc:Bounds x="139" y="263" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="145" y="300" width="23" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_12" bpmnElement="ParallelGateway_1"> - <dc:Bounds x="342" y="255" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="367" y="310" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_74" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> - <dc:Bounds x="415" y="107" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="315" y="89" width="81" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_74"> - <di:waypoint xsi:type="dc:Point" x="367" y="255" /> - <di:waypoint xsi:type="dc:Point" x="367" y="132" /> - <di:waypoint xsi:type="dc:Point" x="415" y="132" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="438" y="212" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="CallActivity_0jz0w0k_di"> - <di:waypoint xsi:type="dc:Point" x="440" y="107" /> - <di:waypoint xsi:type="dc:Point" x="440" y="65" /> - <di:waypoint xsi:type="dc:Point" x="553" y="65" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="475" y="70" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_15" bpmnElement="ParallelGateway_4" isMarkerVisible="true"> - <dc:Bounds x="742" y="107" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="767" y="162" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="_BPMNShape_ParallelGateway_15"> - <di:waypoint xsi:type="dc:Point" x="440" y="157" /> - <di:waypoint xsi:type="dc:Point" x="441" y="198" /> - <di:waypoint xsi:type="dc:Point" x="767" y="198" /> - <di:waypoint xsi:type="dc:Point" x="767" y="157" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="452" y="173" width="12" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_79" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true"> - <dc:Bounds x="412" y="468" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="437" y="523" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_79"> - <di:waypoint xsi:type="dc:Point" x="367" y="305" /> - <di:waypoint xsi:type="dc:Point" x="367" y="493" /> - <di:waypoint xsi:type="dc:Point" x="412" y="493" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="445" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_90"> - <di:waypoint xsi:type="dc:Point" x="437" y="468" /> - <di:waypoint xsi:type="dc:Point" x="437" y="402" /> - <di:waypoint xsi:type="dc:Point" x="492" y="402" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="437" y="444" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_91"> - <di:waypoint xsi:type="dc:Point" x="437" y="518" /> - <di:waypoint xsi:type="dc:Point" x="437" y="650" /> - <di:waypoint xsi:type="dc:Point" x="488" y="650" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="437" y="596" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_90" bpmnElement="ServiceTask_3"> - <dc:Bounds x="492" y="362" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_91" bpmnElement="ServiceTask_2"> - <dc:Bounds x="488" y="610" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_80" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true"> - <dc:Bounds x="675" y="376" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="657" y="431" width="87" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ServiceTask_90" targetElement="_BPMNShape_ExclusiveGateway_80"> - <di:waypoint xsi:type="dc:Point" x="592" y="402" /> - <di:waypoint xsi:type="dc:Point" x="675" y="401" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="632" y="404" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_81" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true"> - <dc:Bounds x="674" y="625" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="656" y="680" width="87" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ServiceTask_91" targetElement="_BPMNShape_ExclusiveGateway_81"> - <di:waypoint xsi:type="dc:Point" x="588" y="650" /> - <di:waypoint xsi:type="dc:Point" x="626" y="650" /> - <di:waypoint xsi:type="dc:Point" x="626" y="649" /> - <di:waypoint xsi:type="dc:Point" x="674" y="650" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="636" y="651" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ScriptTask_252"> - <di:waypoint xsi:type="dc:Point" x="700" y="376" /> - <di:waypoint xsi:type="dc:Point" x="701" y="324" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="707" y="351" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_32" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ScriptTask_253"> - <di:waypoint xsi:type="dc:Point" x="699" y="625" /> - <di:waypoint xsi:type="dc:Point" x="699" y="608" /> - <di:waypoint xsi:type="dc:Point" x="699" y="577" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="709" y="657" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_16" bpmnElement="ParallelGateway_5" isMarkerVisible="true"> - <dc:Bounds x="853" y="468" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="523" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ParallelGateway_16"> - <di:waypoint xsi:type="dc:Point" x="725" y="401" /> - <di:waypoint xsi:type="dc:Point" x="878" y="401" /> - <di:waypoint xsi:type="dc:Point" x="878" y="468" /> + <dc:Bounds x="128" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="762" y="392" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ParallelGateway_16"> - <di:waypoint xsi:type="dc:Point" x="724" y="650" /> - <di:waypoint xsi:type="dc:Point" x="878" y="650" /> - <di:waypoint xsi:type="dc:Point" x="878" y="518" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="574" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_17" bpmnElement="ParallelGateway_6"> - <dc:Bounds x="957" y="254" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="982" y="309" width="0" height="0" /> + <dc:Bounds x="134" y="199" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_37" sourceElement="_BPMNShape_ParallelGateway_16" targetElement="_BPMNShape_ParallelGateway_17"> - <di:waypoint xsi:type="dc:Point" x="903" y="493" /> - <di:waypoint xsi:type="dc:Point" x="982" y="493" /> - <di:waypoint xsi:type="dc:Point" x="982" y="304" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="943" y="478" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ParallelGateway_15" targetElement="_BPMNShape_ParallelGateway_17"> - <di:waypoint xsi:type="dc:Point" x="792" y="132" /> - <di:waypoint xsi:type="dc:Point" x="982" y="132" /> - <di:waypoint xsi:type="dc:Point" x="982" y="254" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="887" y="117" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_StartEvent_52" targetElement="_BPMNShape_ScriptTask_99"> - <di:waypoint xsi:type="dc:Point" x="175" y="281" /> - <di:waypoint xsi:type="dc:Point" x="211" y="281" /> + <di:waypoint xsi:type="dc:Point" x="164" y="180" /> + <di:waypoint xsi:type="dc:Point" x="279" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="193" y="281" width="0" height="0" /> + <dc:Bounds x="176.5" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_99" bpmnElement="ScriptTask_8"> - <dc:Bounds x="211" y="241" width="100" height="80" /> + <dc:Bounds x="279" y="140" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="SubProcess_1" isExpanded="true"> - <dc:Bounds x="146" y="759" width="329" height="167" /> + <dc:Bounds x="220" y="365" width="329" height="167" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_100" bpmnElement="ScriptTask_4"> - <dc:Bounds x="259" y="803" width="100" height="80" /> + <dc:Bounds x="333" y="409" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_2"> - <dc:Bounds x="175" y="825" width="36" height="36" /> + <dc:Bounds x="249" y="431" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="193" y="869" width="0" height="0" /> + <dc:Bounds x="222" y="475" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_101" bpmnElement="ScriptTask_2"> - <dc:Bounds x="1054" y="240" width="100" height="80" /> + <dc:Bounds x="589" y="140" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ParallelGateway_17" targetElement="_BPMNShape_ScriptTask_101"> - <di:waypoint xsi:type="dc:Point" x="1007" y="279" /> - <di:waypoint xsi:type="dc:Point" x="1054" y="280" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1177" y="280" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_99" targetElement="_BPMNShape_ParallelGateway_12"> - <di:waypoint xsi:type="dc:Point" x="311" y="281" /> - <di:waypoint xsi:type="dc:Point" x="342" y="280" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="327" y="281" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_129" bpmnElement="EndEvent_6"> - <dc:Bounds x="1188" y="262" width="36" height="36" /> + <dc:Bounds x="856" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1177" y="303" width="57" height="12" /> + <dc:Bounds x="845" y="203" width="57" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_101" targetElement="_BPMNShape_EndEvent_129"> - <di:waypoint xsi:type="dc:Point" x="1154" y="280" /> - <di:waypoint xsi:type="dc:Point" x="1188" y="280" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1171" y="280" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_31" bpmnElement="BoundaryEvent_2"> - <dc:Bounds x="525" y="344" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="563" y="300" width="68" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_32" bpmnElement="BoundaryEvent_3"> - <dc:Bounds x="521" y="592" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="563" y="554" width="68" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_72" bpmnElement="SequenceFlow_72" sourceElement="_BPMNShape_BoundaryEvent_31" targetElement="_BPMNShape_ScriptTask_252"> - <di:waypoint xsi:type="dc:Point" x="543" y="344" /> - <di:waypoint xsi:type="dc:Point" x="543" y="284" /> - <di:waypoint xsi:type="dc:Point" x="651" y="284" /> + <di:waypoint xsi:type="dc:Point" x="689" y="180" /> + <di:waypoint xsi:type="dc:Point" x="856" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="543" y="326" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_73" bpmnElement="SequenceFlow_73" sourceElement="_BPMNShape_ScriptTask_253"> - <di:waypoint xsi:type="dc:Point" x="750" y="537" /> - <di:waypoint xsi:type="dc:Point" x="790" y="537" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="770" y="522" width="0" height="0" /> + <dc:Bounds x="727.5" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_252" bpmnElement="ScriptTask_6"> - <dc:Bounds x="651" y="244" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_253" bpmnElement="ScriptTask_7"> - <dc:Bounds x="650" y="497" width="100" height="80" /> + <dc:Bounds x="431" y="141" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_79" bpmnElement="SequenceFlow_79" sourceElement="_BPMNShape_ScriptTask_252"> - <di:waypoint xsi:type="dc:Point" x="751" y="284" /> - <di:waypoint xsi:type="dc:Point" x="793" y="284" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="772" y="269" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_80" bpmnElement="SequenceFlow_80" sourceElement="_BPMNShape_BoundaryEvent_32" targetElement="_BPMNShape_ScriptTask_253"> - <di:waypoint xsi:type="dc:Point" x="539" y="592" /> - <di:waypoint xsi:type="dc:Point" x="539" y="537" /> - <di:waypoint xsi:type="dc:Point" x="650" y="537" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="567" y="537" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0b9vn2u_di" bpmnElement="EndEvent_2"> - <dc:Bounds x="403" y="825" width="36" height="36" /> + <dc:Bounds x="477" y="431" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="399" y="869" width="47" height="12" /> + <dc:Bounds x="473" y="475" width="47" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1fmpj5u_di" bpmnElement="EndEvent_14"> - <dc:Bounds x="790" y="519" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="808" y="560" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0w1puhf_di" bpmnElement="EndEvent_13"> - <dc:Bounds x="793" y="266" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ko8ggw_di" bpmnElement="SequenceFlow_1ko8ggw"> + <di:waypoint xsi:type="dc:Point" x="285" y="449" /> + <di:waypoint xsi:type="dc:Point" x="333" y="449" /> <bpmndi:BPMNLabel> - <dc:Bounds x="811" y="307" width="0" height="0" /> + <dc:Bounds x="264" y="424" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0m7gwor_di" bpmnElement="SequenceFlow_0m7gwor"> - <di:waypoint xsi:type="dc:Point" x="654" y="65" /> - <di:waypoint xsi:type="dc:Point" x="767" y="65" /> - <di:waypoint xsi:type="dc:Point" x="767" y="107" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pm9r7h_di" bpmnElement="SequenceFlow_1pm9r7h"> + <di:waypoint xsi:type="dc:Point" x="433" y="449" /> + <di:waypoint xsi:type="dc:Point" x="477" y="449" /> <bpmndi:BPMNLabel> - <dc:Bounds x="711" y="50" width="0" height="0" /> + <dc:Bounds x="410" y="424" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ko8ggw_di" bpmnElement="SequenceFlow_1ko8ggw"> - <di:waypoint xsi:type="dc:Point" x="211" y="843" /> - <di:waypoint xsi:type="dc:Point" x="259" y="843" /> + <bpmndi:BPMNEdge id="SequenceFlow_1kx7ea5_di" bpmnElement="SequenceFlow_1kx7ea5"> + <di:waypoint xsi:type="dc:Point" x="379" y="180" /> + <di:waypoint xsi:type="dc:Point" x="431" y="181" /> <bpmndi:BPMNLabel> - <dc:Bounds x="235" y="818" width="0" height="0" /> + <dc:Bounds x="405" y="159.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pm9r7h_di" bpmnElement="SequenceFlow_1pm9r7h"> - <di:waypoint xsi:type="dc:Point" x="359" y="843" /> - <di:waypoint xsi:type="dc:Point" x="403" y="843" /> + <bpmndi:BPMNEdge id="SequenceFlow_1u8shdz_di" bpmnElement="SequenceFlow_1u8shdz"> + <di:waypoint xsi:type="dc:Point" x="531" y="181" /> + <di:waypoint xsi:type="dc:Point" x="589" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="381" y="818" width="0" height="0" /> + <dc:Bounds x="560" y="159.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0jz0w0k_di" bpmnElement="Task_0ixuwt5"> - <dc:Bounds x="554" y="25" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy index 99c351c465..119159f458 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -1,22 +1,22 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ package org.onap.so.bpmn.common.scripts @@ -24,13 +24,17 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor +import org.mockito.Mock import org.mockito.MockitoAnnotations +import org.mockito.Spy import org.mockito.runners.MockitoJUnitRunner import org.onap.so.bpmn.core.WorkflowException - +import org.onap.so.db.request.beans.InfraActiveRequests +import org.onap.so.db.request.client.RequestsDbClient import static org.assertj.core.api.Assertions.assertThat import static org.assertj.core.api.Assertions.assertThatThrownBy import static org.mockito.ArgumentMatchers.eq @@ -38,27 +42,20 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class CompleteMsoProcessTest { - @Before - public void init() { - MockitoAnnotations.initMocks(this) - } - - private String completeMsoProcessRequest = """ - <sdncadapterworkflow:MsoCompletionRequest xmlns:ns="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <ns:request-information> - <ns:request-id>uCPE1020_STUW105_5002</ns:request-id> - <ns:request-action>Layer3ServiceActivateRequest</ns:request-action> - <ns:request-sub-action>COMPLETE</ns:request-sub-action> - <ns:source>OMX</ns:source> - <ns:notification-url>http://localhost:28090/CCD/StatusNotification</ns:notification-url> - <ns:order-number>10205000</ns:order-number> - <ns:order-version>1</ns:order-version> - </ns:request-information> - <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name> - </sdncadapterworkflow:MsoCompletionRequest> - """ - - private String completeMsoNetworkProcessRequest = """ + + @Mock + RequestsDbClient requestsDbClient; + + @Spy + CompleteMsoProcess completeMsoProcess; + + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String completeMsoNetworkProcessRequest = """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1"> <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> @@ -71,104 +68,39 @@ class CompleteMsoProcessTest { <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name> </aetgt:MsoCompletionRequest>""" - @Test - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) - when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C"); - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() - completeMsoProcess.preProcessRequest(mockExecution) - - /* Initialize all the process request variables in this block */ - verify(mockExecution).setVariable("prefix","CMSO_") - //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") - verify(mockExecution).setVariable("CMSO_request_id","") - verify(mockExecution).setVariable("CMSO_notification-url","") - verify(mockExecution).setVariable("CMSO_mso-bpel-name","") - verify(mockExecution).setVariable("CMSO_request_action","") - - verify(mockExecution).setVariable("CMSO_notification-url-Ok", false) - verify(mockExecution).setVariable("CMSO_request_id-Ok", false) - - //updateRequest Adapter process variables - verify(mockExecution).setVariable("CMSO_updateRequestResponse", "") - verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "") - verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") - - //Set DB adapter variables here - verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "") - verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "") - verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") - - //Auth variables - verify(mockExecution).setVariable("BasicAuthHeaderValue","") - - //Response variables - verify(mockExecution).setVariable("CompletionHandlerResponse","") - verify(mockExecution).setVariable("CMSO_ErrorResponse", null) - verify(mockExecution).setVariable("CMSO_ResponseCode", "") - - verify(mockExecution).setVariable("CMSO_notification-url-Ok",true) - verify(mockExecution).setVariable("CMSO_request_id-Ok",true) - verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification") - verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002") - verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest") - verify(mockExecution).setVariable("CMSO_source","OMX") - - } - - private String setUpdateDBstatustoSuccessPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <statusMessage>Resource Completed Successfully</statusMessage> - <requestStatus>COMPLETE</requestStatus> - <progress>100</progress> - <networkId>bd631913-cfc6-488b-ba22-6b98504f703d</networkId> - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope>""" - - @Test - public void testsetUpdateDBstatustoSuccessPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") - when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest); - - CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() - completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) - - verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) - } - - private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapterworkflow:out>BPEL BPEL-NAME FAILED</sdncadapterworkflow:out> -</sdncadapterworkflow:MsoCompletionResponse>""" - - - @Test - void postProcessResponse_successful() { - DelegateExecution mockExecution = mock(DelegateExecution.class) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("mso-bpel-test") - new CompleteMsoProcess().postProcessResponse(mockExecution) - - String expectedResponse = "<sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow=\"http://ecomp.com/mso/workflow/schema/v1\">\n" + - " <sdncadapterworkflow:out>BPEL mso-bpel-test completed</sdncadapterworkflow:out>\n" + - "</sdncadapterworkflow:MsoCompletionResponse>" - - verify(mockExecution).setVariable("WorkflowResponse", expectedResponse) - verify(mockExecution).setVariable("CompleteMsoProcessResponse", expectedResponse) - verify(mockExecution).setVariable("CMSO_ResponseCode", "200") - } + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest) + + completeMsoProcess.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("CMSO_request_id", "bd631913-cfc6-488b-ba22-6b98504f703d") + } + + + @Test + public void testUpdateInfraRequestDB(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest); + when(completeMsoProcess.getDbClient()).thenReturn(requestsDbClient) + completeMsoProcess.updateInfraRequestDB(mockExecution) + + InfraActiveRequests request = new InfraActiveRequests() + request.setRequestId("testReqId") + + completeMsoProcess.updateInfraRequestDB(mockExecution) + + request.setRequestStatus("COMPLETED") + request.setStatusMessage("Resource Completed Successfully") + request.setProgress(100) + request.setLastModifiedBy("BPMN") + request.setNetworkId("bd631913-cfc6-488b-ba22-6b98504f703d") + + + verify(requestsDbClient, times(2)).updateInfraActiveRequests(request, null, null) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy index 25f62a6555..6cae293971 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -1,22 +1,22 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ package org.onap.so.bpmn.common.scripts @@ -29,31 +29,41 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor; +import org.mockito.Mock import org.mockito.MockitoAnnotations +import org.mockito.Spy import org.mockito.runners.MockitoJUnitRunner import org.onap.so.bpmn.common.scripts.MsoUtils; +import org.onap.so.db.request.beans.InfraActiveRequests +import org.onap.so.db.request.client.RequestsDbClient import org.onap.so.bpmn.common.scripts.FalloutHandler; @RunWith(MockitoJUnitRunner.class) class FalloutHandlerTest { - - public MsoUtils utils = new MsoUtils() - - @Before - public void init() { - MockitoAnnotations.initMocks(this) - } - private String falloutHandlerRequest = """ + public MsoUtils utils = new MsoUtils() + + @Spy + FalloutHandler falloutHandler = new FalloutHandler() + + @Mock + RequestsDbClient requestsDbClient; + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String falloutHandlerRequest = """ <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:ns7="http://org.onap/so/request/types/v1"> - <ns7:request-information> + <ns7:request-info> <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id> <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action> <ns7:request-sub-action>CANCEL</ns7:request-sub-action> <ns7:source>OMX</ns7:source> <ns7:order-number>10205000</ns7:order-number> <ns7:order-version>1</ns7:order-version> - </ns7:request-information> + </ns7:request-info> <sdncadapterworkflow:WorkflowException> <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage> <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode> @@ -62,251 +72,64 @@ class FalloutHandlerTest { </sdncadapterworkflow:FalloutHandlerRequest> """ - private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> + private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> <workflow:out>Fallout Handler Failed</workflow:out> </workflow:FalloutHandlerResponse>""" - @Test - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) - when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C"); - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.preProcessRequest(mockExecution) - - /* Initialize all the process request variables in this block */ - verify(mockExecution).setVariable("prefix","FH_") - //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + @Test + public void testPreProcessRequest() { - //These variables are form the input Message to the BPMN - verify(mockExecution).setVariable("FH_request_id","") - verify(mockExecution).setVariable("FH_request_action","") - verify(mockExecution).setVariable("FH_notification-url","") - verify(mockExecution).setVariable("FH_mso-bpel-name","") - verify(mockExecution).setVariable("FH_ErrorCode", "") - verify(mockExecution).setVariable("FH_ErrorMessage", "") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) - verify(mockExecution).setVariable("FH_notification-url-Ok", false) - verify(mockExecution).setVariable("FH_request_id-Ok", false) + when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) - //These variables are for Get Mso Aai Password Adapter - verify(mockExecution).setVariable("FH_deliveryStatus", true) + falloutHandler.preProcessRequest(mockExecution) - //update Response Status to pending ...Adapter variables - verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) - verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) + verify(mockExecution).setVariable("FH_success", true) + verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") + verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + } - //update Request Gamma ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") - verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) - verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) + @Test + public void testpostProcessResponse(){ - //update Request Infra ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") - verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) - verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) - //assign False to success variable - verify(mockExecution).setVariable("FH_success", true) + when(mockExecution.getVariable("FH_success")).thenReturn(false) - //Set notify status to Failed variable - verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") + falloutHandler.postProcessResponse(mockExecution) - //Set DB update variable - verify(mockExecution).setVariable("FH_updateRequestPayload", "") - verify(mockExecution).setVariable("FH_updateRequestResponse", null) - verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - //Auth variables - verify(mockExecution).setVariable("BasicAuthHeaderValue","") + verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(1) - //Response variables - verify(mockExecution).setVariable("FalloutHandlerResponse","") - verify(mockExecution).setVariable("FH_ErrorResponse", null) - verify(mockExecution).setVariable("FH_ResponseCode", "") + assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - verify(mockExecution).setVariable("FH_request_id-Ok",true) - verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") - verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") - verify(mockExecution).setVariable("FH_source","OMX") - verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") - verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + verify(mockExecution).setVariable("FH_ResponseCode","500") + } - } - @Test - public void testpostProcessResponse(){ + @Test + public void testUpdateInfraRequestDB(){ - ExecutionEntity mockExecution = mock(ExecutionEntity.class) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(falloutHandler.getDbClient()).thenReturn(requestsDbClient) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("FH_success")).thenReturn(false) - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.postProcessResponse(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(1) - - assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - - verify(mockExecution).setVariable("FH_ResponseCode","500") - } - - private String updateRequestPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>ErrorMessage</finalErrorMessage> - <finalErrorCode>ErrorCode</finalErrorCode> - <status>FAILED</status> - <responseStatus>NotifyStatus</responseStatus> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestInfraPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <statusMessage>ErrorMessage</statusMessage> - <requestStatus>FAILED</requestStatus> - <progress>100</progress> - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestInfraPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestInfraPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestGammaPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>ErrorMessage</finalErrorMessage> - <finalErrorCode>ErrorCode</finalErrorCode> - <status>FAILED</status> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestGammaPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - when(mockExecution.getVariable("mso.default.adapter.namespace")).thenReturn("http://org.onap.so"); - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestGammaPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - - String updateResponseStatusPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateResponseStatus> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <responseStatus>SENDING_FINAL_NOTIFY</responseStatus> - </req:updateResponseStatus> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateResponseStatusPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + falloutHandler.updateInfraRequestDB(mockExecution) - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateResponseStatusPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(0) - - assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - } + InfraActiveRequests infraRequest = new InfraActiveRequests(); + infraRequest.setLastModifiedBy("BPMN") + infraRequest.setStatusMessage("ErrorMessage") + infraRequest.setRequestStatus("FAILED") + infraRequest.setProgress(100) + verify(requestsDbClient, times(1)).updateInfraActiveRequests(infraRequest, null, null) + } }
\ 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 335d5b9d70..955cf94618 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 @@ -450,7 +450,8 @@ public class BBInputSetupTest { doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), - requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, + false); doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); @@ -501,7 +502,8 @@ public class BBInputSetupTest { doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), - requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, + false); doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, @@ -804,7 +806,7 @@ public class BBInputSetupTest { doReturn(ModelType.network).when(modelInfo).getModelType(); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, - serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false); verify(SPY_bbInputSetup, times(1)).populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); assertEquals("NetworkId populated", true, @@ -816,7 +818,7 @@ public class BBInputSetupTest { lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, - serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false); verify(SPY_bbInputSetup, times(1)).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); @@ -828,7 +830,7 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, - serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false); verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); assertEquals("VolumeGroupId populated", true, @@ -837,11 +839,11 @@ public class BBInputSetupTest { doReturn(ModelType.vfModule).when(modelInfo).getModelType(); resourceId = "vfModuleId"; doNothing().when(SPY_bbInputSetup).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, - serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false); verify(SPY_bbInputSetup, times(1)).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false); assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId)); } @@ -1965,7 +1967,7 @@ public class BBInputSetupTest { SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), - any(), isA(CloudConfiguration.class)); + any(), isA(CloudConfiguration.class), Mockito.anyBoolean()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); @@ -2249,7 +2251,7 @@ public class BBInputSetupTest { SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), - any(), isA(CloudConfiguration.class)); + any(), isA(CloudConfiguration.class), Mockito.anyBoolean()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); @@ -2314,7 +2316,7 @@ public class BBInputSetupTest { SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), - any(), isA(CloudConfiguration.class)); + any(), isA(CloudConfiguration.class), Mockito.anyBoolean()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); @@ -2883,7 +2885,76 @@ public class BBInputSetupTest { isA(Service.class), isA(String.class)); SPY_bbInputSetup.populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); + resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration, false); + + verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), + isA(Service.class), isA(String.class)); + assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, + lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); + assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, + lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); + } + + @Test + public void testPopulateVfModuleIsReplace() throws Exception { + String vnfId = "vnfId"; + String vfModuleId = "vfModuleId"; + String volumeGroupId = "volumeGroupId"; + String vfModuleCustomizationId = "vfModuleCustomizationId"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId(vfModuleCustomizationId); + Service service = new Service(); + String bbName = AssignFlows.VF_MODULE.toString(); + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId(vnfId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + vnf.getVolumeGroups().add(volumeGroup); + serviceInstance.getVnfs().add(vnf); + VfModule vfModule1 = new VfModule(); + vfModule1.setVfModuleId("vfModuleId1"); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleId("vfModuleId2"); + vnf.getVfModules().add(vfModule1); + vnf.getVfModules().add(vfModule2); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + String resourceId = vfModuleId; + RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[1]; + RelatedInstanceList relatedInstanceListObj = new RelatedInstanceList(); + RelatedInstance relatedInstance = new RelatedInstance(); + relatedInstance.setInstanceId(vnfId); + + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationId("vnfCustomizationId"); + vnfModelInfo.setModelType(ModelType.vnf); + relatedInstance.setModelInfo(vnfModelInfo); + relatedInstanceListObj.setRelatedInstance(relatedInstance); + relatedInstanceList[0] = relatedInstanceListObj; + + String instanceName = "vfModuleName"; + List<Map<String, String>> instanceParams = null; + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("vnfModelCustId"); + org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup(); + volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId); + org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule(); + vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId); + + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class)); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), + isA(Service.class)); + doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), + isA(Service.class), isA(String.class)); + + SPY_bbInputSetup.populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true); verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json index fe58357d53..361dd9f405 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json @@ -1,7 +1,5 @@ { "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", - "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", - "action": "deleteInstance", "requestStatus": "COMPLETE", "statusMessage": "Vf Module has been deleted successfully.", "progress": 100, @@ -12,22 +10,18 @@ "vnfName": null, "vnfType": null, "serviceType": null, - "aicNodeClli": null, "tenantId": "6accefef3cb442ff9e644d589fb04107", - "provStatus": null, "vnfParams": null, "vnfOutputs": null, "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", "responseBody": null, "lastModifiedBy": "BPMN", "modifyTime": 1482451228000, - "requestType": null, "volumeGroupId": null, "volumeGroupName": null, "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", "vfModuleName": null, "vfModuleModelName": "vSAMP10aDEV::base::module-0", - "aaiServiceId": null, "aicCloudRegion": "mtn6", "callBackUrl": null, "correlator": null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json index dd4dc65190..9c962e9722 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json @@ -1,7 +1,5 @@ { "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", - "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", - "action": "deleteInstance", "requestStatus": "COMPLETE", "statusMessage": "Vf Module has been deleted successfully.", "progress": 100, @@ -12,22 +10,18 @@ "vnfName": null, "vnfType": null, "serviceType": null, - "aicNodeClli": null, "tenantId": "6accefef3cb442ff9e644d589fb04107", - "provStatus": null, "vnfParams": null, "vnfOutputs": null, "requestBody": "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}}", "responseBody": null, "lastModifiedBy": "BPMN", "modifyTime": 1482451228000, - "requestType": null, "volumeGroupId": null, "volumeGroupName": null, "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", "vfModuleName": null, "vfModuleModelName": "vSAMP10aDEV::base::module-0", - "aaiServiceId": null, "aicCloudRegion": "mtn6", "callBackUrl": null, "correlator": null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json index 9cc84f2cd4..3623e888e7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json @@ -1,7 +1,5 @@ { "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", - "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", - "action": "deleteInstance", "requestStatus": "COMPLETE", "statusMessage": "Vf Module has been deleted successfully.", "progress": 100, @@ -12,22 +10,18 @@ "vnfName": null, "vnfType": null, "serviceType": null, - "aicNodeClli": null, "tenantId": "6accefef3cb442ff9e644d589fb04107", - "provStatus": null, "vnfParams": null, "vnfOutputs": null, "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", "responseBody": null, "lastModifiedBy": "BPMN", "modifyTime": 1482451228000, - "requestType": null, "volumeGroupId": null, "volumeGroupName": null, "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", "vfModuleName": null, "vfModuleModelName": "vSAMP10aDEV::base::module-0", - "aaiServiceId": null, "aicCloudRegion": "mtn6", "callBackUrl": null, "correlator": null, diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 25913eabba..1ae0dd48f7 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -93,10 +93,19 @@ <artifactId>maven-jar-plugin</artifactId> <executions> <execution> - <id>tests</id> + <id>tests-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + <configuration> + <skip>false</skip> + </configuration> </execution> <execution> <id>original</id> + <configuration> + <skip>false</skip> + </configuration> </execution> </executions> </plugin> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index ace6e1937d..4fb63651eb 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -102,7 +102,11 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables)); processor.startProcess(processKey, variableMap); WorkflowResponse response = waitForResponse(inputVariables); - return Response.status(202).entity(response).build(); + if (response.getMessageCode() == 500) { + return Response.status(500).entity(response).build(); + } else { + return Response.status(202).entity(response).build(); + } } catch (WorkflowProcessorException e) { WorkflowResponse response = e.getWorkflowResponse(); return Response.status(500).entity(response).build(); @@ -112,7 +116,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { } } - private WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception { + protected WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception { String requestId = getRequestId(inputVariables); long currentWaitTime = 0; long waitTime = getWaitTime(inputVariables); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java deleted file mode 100644 index 56526c7f89..0000000000 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.onap.so.bpmn.core.plugins; - -import org.camunda.bpm.engine.delegate.ExecutionListener; -import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; -import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; -import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; -import org.camunda.bpm.engine.impl.util.xml.Element; -import org.springframework.stereotype.Component; - -@Component -public class AsyncTaskExecutor extends AbstractBpmnParseListener { - - private void injectTaskExecutorExecutionListener(ActivityImpl activity) { - activity.addListener(ExecutionListener.EVENTNAME_END, new AsyncTaskExecutorListener()); - } - - @Override - public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) { - injectTaskExecutorExecutionListener(activity); - } -} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java deleted file mode 100644 index 96c6af42ed..0000000000 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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.core.plugins; - -import java.util.ArrayList; -import java.util.List; -import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; -import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - - - -@Component -public class BPMNProcessCompletePlugin extends AbstractProcessEnginePlugin { - - @Autowired - private AsyncTaskExecutor asyncTaskExecutor; - - @Override - public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { - List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); - if (preParseListeners == null) { - preParseListeners = new ArrayList<>(); - processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); - } - preParseListeners.add(asyncTaskExecutor); - } - -} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceTest.java new file mode 100644 index 0000000000..df9a23019a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceTest.java @@ -0,0 +1,59 @@ +package org.onap.so.bpmn.common.workflow.service; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.ArgumentMatchers.anyMap; +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.core.Response; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; + +@RunWith(MockitoJUnitRunner.class) +public class WorkflowAsyncResourceTest { + + @InjectMocks + @Spy + private WorkflowAsyncResource workflowAsyncResource; + + @Mock + private WorkflowProcessor processor; + + private WorkflowResponse workflowResponse; + private VariableMapImpl varMap; + + @Before + public void before() { + workflowResponse = new WorkflowResponse(); + varMap = new VariableMapImpl(); + Map<String, Object> variables = new HashMap<String, Object>(); + Map<String, Object> requestIdMap = new HashMap<String, Object>(); + requestIdMap.put("value", "123"); + requestIdMap.put("type", "String"); + variables.put("mso-request-id", requestIdMap); + varMap.put("variables", variables); + } + + @Test + public void startProcessInstanceByKey200Test() throws Exception { + workflowResponse.setMessageCode(200); + doReturn(workflowResponse).when(workflowAsyncResource).waitForResponse(anyMap()); + Response response = workflowAsyncResource.startProcessInstanceByKey("123", varMap); + assertEquals(202, response.getStatus()); + } + + @Test + public void startProcessInstanceByKey500Test() throws Exception { + workflowResponse.setMessageCode(500); + doReturn(workflowResponse).when(workflowAsyncResource).waitForResponse(anyMap()); + Response response = workflowAsyncResource.startProcessInstanceByKey("123", varMap); + assertEquals(500, response.getStatus()); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index 078317885c..43fbc59b3d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -34,7 +34,7 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index bb900420e3..f2e0ce29ff 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2"> <bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true"> + <bpmn:extensionElements> + <camunda:executionListener class="org.onap.so.bpmn.core.plugins.AsyncTaskExecutorListener" event="end" /> + </bpmn:extensionElements> <bpmn:startEvent id="Start_WorkflowActionBB" name="start"> <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> </bpmn:startEvent> @@ -46,7 +49,7 @@ <bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}"> <bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming> @@ -83,19 +86,19 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" /> <bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" /> - <bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}"> + <bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendErrorSyncAck(execution)}"> <bpmn:incoming>SequenceFlow_0vi883o</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0eana0l</bpmn:outgoing> </bpmn:serviceTask> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}"> <bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming> @@ -104,7 +107,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" /> <bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}"> <bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming> @@ -127,7 +130,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" /> <bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0"> <bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming> @@ -136,7 +139,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" /> <bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen"> <bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming> @@ -144,13 +147,13 @@ <bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:endEvent id="End_RollbackFailed" name="end"> <bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}"> <bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming> @@ -158,7 +161,7 @@ <bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" /> <bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true"> @@ -202,7 +205,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_1lrz41x" sourceRef="Task_SendSync" targetRef="ExclusiveGateway_1dez26n" /> <bpmn:sequenceFlow id="SequenceFlow_0etawv5" name="no" sourceRef="ExclusiveGateway_1dez26n" targetRef="Task_PreValidateWorkflow"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:endEvent id="EndEvent_12f15tu" name="End"> <bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming> @@ -213,406 +216,406 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="WorkflowActionBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_WorkflowActionBB"> - <dc:Bounds x="-434" y="102" width="36" height="36" /> + <dc:Bounds x="156" y="378" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-426" y="138" width="22" height="12" /> + <dc:Bounds x="164" y="414" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB"> - <dc:Bounds x="1304" y="147" width="36" height="36" /> + <dc:Bounds x="1894" y="423" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1313" y="127" width="18" height="12" /> + <dc:Bounds x="1903" y="403" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp"> - <di:waypoint xsi:type="dc:Point" x="-398" y="120" /> - <di:waypoint xsi:type="dc:Point" x="-365" y="120" /> + <di:waypoint x="192" y="396" /> + <di:waypoint x="225" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="-381" y="99" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB"> - <dc:Bounds x="560" y="80" width="100" height="80" /> + <dc:Bounds x="1150" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv"> - <di:waypoint xsi:type="dc:Point" x="339" y="120" /> - <di:waypoint xsi:type="dc:Point" x="400" y="120" /> + <di:waypoint x="929" y="396" /> + <di:waypoint x="990" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="324.5" y="105" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1snenqk_di" bpmnElement="Task_SelectBB"> - <dc:Bounds x="239" y="80" width="100" height="80" /> + <dc:Bounds x="829" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0m1zt0q_di" bpmnElement="ExclusiveGateway_Finished" isMarkerVisible="true"> - <dc:Bounds x="911" y="95" width="50" height="50" /> + <dc:Bounds x="1501" y="371" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="850" y="42" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj"> - <di:waypoint xsi:type="dc:Point" x="949" y="132" /> - <di:waypoint xsi:type="dc:Point" x="980" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1060" y="165" /> + <di:waypoint x="1539" y="408" /> + <di:waypoint x="1570" y="441" /> + <di:waypoint x="1650" y="441" /> <bpmndi:BPMNLabel> - <dc:Bounds x="968" y="168" width="83" height="12" /> + <dc:Bounds x="1557" y="444" width="85" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList"> - <dc:Bounds x="-365" y="80" width="100" height="80" /> + <dc:Bounds x="225" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync"> - <dc:Bounds x="-100" y="-76" width="100" height="80" /> + <dc:Bounds x="490" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete"> - <dc:Bounds x="1161" y="206" width="100" height="80" /> + <dc:Bounds x="1751" y="482" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz"> - <di:waypoint xsi:type="dc:Point" x="1261" y="246" /> - <di:waypoint xsi:type="dc:Point" x="1322" y="246" /> - <di:waypoint xsi:type="dc:Point" x="1322" y="183" /> + <di:waypoint x="1851" y="522" /> + <di:waypoint x="1912" y="522" /> + <di:waypoint x="1912" y="459" /> <bpmndi:BPMNLabel> <dc:Bounds x="1247" y="231" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_18226x4_di" bpmnElement="SubProcess_18226x4" isExpanded="true"> - <dc:Bounds x="498" y="444" width="438" height="297" /> + <dc:Bounds x="1088" y="720" width="438" height="297" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_184g7f3_di" bpmnElement="ErrorStart"> - <dc:Bounds x="520" y="639" width="36" height="36" /> + <dc:Bounds x="1110" y="915" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="526" y="682" width="24" height="12" /> + <dc:Bounds x="1116" y="958" width="24" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0l4edvr_di" bpmnElement="ErrorEnd"> - <dc:Bounds x="880" y="639" width="36" height="36" /> + <dc:Bounds x="1470" y="915" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="890" y="681" width="18" height="12" /> + <dc:Bounds x="1480" y="957" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm"> - <di:waypoint xsi:type="dc:Point" x="936" y="145" /> - <di:waypoint xsi:type="dc:Point" x="936" y="262" /> - <di:waypoint xsi:type="dc:Point" x="339" y="262" /> + <di:waypoint x="1526" y="421" /> + <di:waypoint x="1526" y="538" /> + <di:waypoint x="929" y="538" /> <bpmndi:BPMNLabel> - <dc:Bounds x="769.202380952381" y="272" width="73" height="12" /> + <dc:Bounds x="1359" y="548" width="74" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn"> - <di:waypoint xsi:type="dc:Point" x="289" y="222" /> - <di:waypoint xsi:type="dc:Point" x="289" y="160" /> + <di:waypoint x="879" y="498" /> + <di:waypoint x="879" y="436" /> <bpmndi:BPMNLabel> <dc:Bounds x="259" y="191" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_19t1oyr_di" bpmnElement="Task_RollbackExecutionPath"> - <dc:Bounds x="239" y="222" width="100" height="80" /> + <dc:Bounds x="829" y="498" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9"> - <di:waypoint xsi:type="dc:Point" x="-265" y="120" /> - <di:waypoint xsi:type="dc:Point" x="-228" y="120" /> + <di:waypoint x="325" y="396" /> + <di:waypoint x="362" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="-246" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei"> - <di:waypoint xsi:type="dc:Point" x="946" y="105" /> - <di:waypoint xsi:type="dc:Point" x="983" y="44" /> - <di:waypoint xsi:type="dc:Point" x="1060" y="45" /> + <di:waypoint x="1536" y="381" /> + <di:waypoint x="1573" y="320" /> + <di:waypoint x="1650" y="321" /> <bpmndi:BPMNLabel> - <dc:Bounds x="975" y="17" width="58" height="12" /> + <dc:Bounds x="1565" y="293" width="58" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0jo36ez_di" bpmnElement="Task_AbortAndCallErrorHandling"> - <dc:Bounds x="1176" y="-76" width="100" height="80" /> + <dc:Bounds x="1766" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0lzz1ya_di" bpmnElement="EndEvent_0lzz1ya"> - <dc:Bounds x="1386" y="27" width="36" height="36" /> + <dc:Bounds x="1976" y="303" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1395" y="67" width="18" height="12" /> + <dc:Bounds x="1985" y="343" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6"> - <di:waypoint xsi:type="dc:Point" x="1276" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="1359" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="1359" y="45" /> - <di:waypoint xsi:type="dc:Point" x="1386" y="45" /> + <di:waypoint x="1866" y="240" /> + <di:waypoint x="1949" y="240" /> + <di:waypoint x="1949" y="321" /> + <di:waypoint x="1976" y="321" /> <bpmndi:BPMNLabel> <dc:Bounds x="1329" y="5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u"> - <di:waypoint xsi:type="dc:Point" x="936" y="95" /> - <di:waypoint xsi:type="dc:Point" x="936" y="55" /> - <di:waypoint xsi:type="dc:Point" x="936" y="55" /> - <di:waypoint xsi:type="dc:Point" x="936" y="4" /> + <di:waypoint x="1526" y="371" /> + <di:waypoint x="1526" y="331" /> + <di:waypoint x="1526" y="331" /> + <di:waypoint x="1526" y="280" /> <bpmndi:BPMNLabel> <dc:Bounds x="906" y="49" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1c1v3p1_di" bpmnElement="Task_0a31dkf"> - <dc:Bounds x="886" y="-76" width="100" height="80" /> + <dc:Bounds x="1476" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true"> - <dc:Bounds x="-228" y="95" width="50" height="50" /> + <dc:Bounds x="362" y="371" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-235" y="145" width="63" height="24" /> + <dc:Bounds x="357" y="421" width="60" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv"> - <di:waypoint xsi:type="dc:Point" x="-202" y="96" /> - <di:waypoint xsi:type="dc:Point" x="-202" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="-100" y="-36" /> + <di:waypoint x="388" y="372" /> + <di:waypoint x="388" y="240" /> + <di:waypoint x="490" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-195" y="17.612903225806477" width="19" height="12" /> + <dc:Bounds x="396" y="294" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4"> - <di:waypoint xsi:type="dc:Point" x="-178" y="120" /> - <di:waypoint xsi:type="dc:Point" x="80" y="120" /> + <di:waypoint x="412" y="396" /> + <di:waypoint x="670" y="396" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" /> + <dc:Bounds x="503" y="376" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true"> - <dc:Bounds x="1060" y="20" width="50" height="50" /> + <dc:Bounds x="1650" y="296" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="70" width="61" height="24" /> + <dc:Bounds x="1646" y="346" width="60" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0"> - <di:waypoint xsi:type="dc:Point" x="1085" y="20" /> - <di:waypoint xsi:type="dc:Point" x="1085" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="1176" y="-37" /> + <di:waypoint x="1675" y="296" /> + <di:waypoint x="1675" y="239" /> + <di:waypoint x="1766" y="239" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1091" y="-8" width="19" height="12" /> + <dc:Bounds x="1682" y="268" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3"> - <di:waypoint xsi:type="dc:Point" x="1110" y="45" /> - <di:waypoint xsi:type="dc:Point" x="1386" y="45" /> + <di:waypoint x="1700" y="321" /> + <di:waypoint x="1976" y="321" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1242" y="20" width="12" height="12" /> + <dc:Bounds x="1832" y="296" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1er1kam_di" bpmnElement="ExclusiveGateway_isTopLevelFlowC" isMarkerVisible="true"> - <dc:Bounds x="1060" y="140" width="50" height="50" /> + <dc:Bounds x="1650" y="416" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="108" width="61" height="24" /> + <dc:Bounds x="1646" y="384" width="60" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp"> - <di:waypoint xsi:type="dc:Point" x="1110" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1220" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1220" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1304" y="165" /> + <di:waypoint x="1700" y="441" /> + <di:waypoint x="1810" y="441" /> + <di:waypoint x="1810" y="441" /> + <di:waypoint x="1894" y="441" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1256" y="140" width="12" height="12" /> + <dc:Bounds x="1846" y="416" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1q8eh5e_di" bpmnElement="End_RollbackFailed"> - <dc:Bounds x="1159" y="347" width="36" height="36" /> + <dc:Bounds x="1749" y="623" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1177" y="399" width="18" height="12" /> + <dc:Bounds x="1767" y="675" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt"> - <di:waypoint xsi:type="dc:Point" x="289" y="302" /> - <di:waypoint xsi:type="dc:Point" x="289" y="368" /> - <di:waypoint xsi:type="dc:Point" x="960" y="368" /> + <di:waypoint x="879" y="578" /> + <di:waypoint x="879" y="644" /> + <di:waypoint x="1550" y="644" /> <bpmndi:BPMNLabel> - <dc:Bounds x="381.45685840707966" y="325" width="63" height="24" /> + <dc:Bounds x="972" y="601" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1h154rn_di" bpmnElement="Task_UpdateDb"> - <dc:Bounds x="713" y="617" width="100" height="80" /> + <dc:Bounds x="1303" y="893" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1t8n9gd_di" bpmnElement="Task_UpdateRequestToFailed"> - <dc:Bounds x="960" y="325" width="100" height="80" /> + <dc:Bounds x="1550" y="601" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba"> - <di:waypoint xsi:type="dc:Point" x="942" y="139" /> - <di:waypoint xsi:type="dc:Point" x="976" y="252" /> - <di:waypoint xsi:type="dc:Point" x="1016" y="252" /> - <di:waypoint xsi:type="dc:Point" x="1016" y="325" /> + <di:waypoint x="1532" y="415" /> + <di:waypoint x="1566" y="528" /> + <di:waypoint x="1606" y="528" /> + <di:waypoint x="1606" y="601" /> <bpmndi:BPMNLabel> - <dc:Bounds x="959" y="255" width="52" height="24" /> + <dc:Bounds x="1548" y="531" width="54" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x"> - <di:waypoint xsi:type="dc:Point" x="556" y="657" /> - <di:waypoint xsi:type="dc:Point" x="602" y="657" /> + <di:waypoint x="1146" y="933" /> + <di:waypoint x="1192" y="933" /> <bpmndi:BPMNLabel> <dc:Bounds x="534" y="636" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf"> - <di:waypoint xsi:type="dc:Point" x="813" y="657" /> - <di:waypoint xsi:type="dc:Point" x="880" y="657" /> + <di:waypoint x="1403" y="933" /> + <di:waypoint x="1470" y="933" /> <bpmndi:BPMNLabel> <dc:Bounds x="801.5" y="636" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc"> - <di:waypoint xsi:type="dc:Point" x="1060" y="365" /> - <di:waypoint xsi:type="dc:Point" x="1134" y="365" /> - <di:waypoint xsi:type="dc:Point" x="1134" y="365" /> - <di:waypoint xsi:type="dc:Point" x="1159" y="365" /> + <di:waypoint x="1650" y="641" /> + <di:waypoint x="1724" y="641" /> + <di:waypoint x="1724" y="641" /> + <di:waypoint x="1749" y="641" /> <bpmndi:BPMNLabel> <dc:Bounds x="1104" y="359" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_10q79b6_di" bpmnElement="ExclusiveGateway_10q79b6" isMarkerVisible="true"> - <dc:Bounds x="602" y="632" width="50" height="50" /> + <dc:Bounds x="1192" y="908" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="584" y="686" width="86" height="36" /> + <dc:Bounds x="1174" y="962" width="86" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1"> - <di:waypoint xsi:type="dc:Point" x="652" y="657" /> - <di:waypoint xsi:type="dc:Point" x="683" y="657" /> - <di:waypoint xsi:type="dc:Point" x="683" y="657" /> - <di:waypoint xsi:type="dc:Point" x="713" y="657" /> + <di:waypoint x="1242" y="933" /> + <di:waypoint x="1273" y="933" /> + <di:waypoint x="1273" y="933" /> + <di:waypoint x="1303" y="933" /> <bpmndi:BPMNLabel> - <dc:Bounds x="677" y="634" width="12" height="12" /> + <dc:Bounds x="1267" y="910" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o"> - <di:waypoint xsi:type="dc:Point" x="627" y="632" /> - <di:waypoint xsi:type="dc:Point" x="627" y="548" /> - <di:waypoint xsi:type="dc:Point" x="713" y="548" /> + <di:waypoint x="1217" y="908" /> + <di:waypoint x="1217" y="824" /> + <di:waypoint x="1303" y="824" /> <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="584" width="18" height="12" /> + <dc:Bounds x="1223" y="860" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l"> - <di:waypoint xsi:type="dc:Point" x="763" y="588" /> - <di:waypoint xsi:type="dc:Point" x="763" y="617" /> + <di:waypoint x="1353" y="864" /> + <di:waypoint x="1353" y="893" /> <bpmndi:BPMNLabel> <dc:Bounds x="778" y="596.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_10hs368_di" bpmnElement="Task_SendSyncAckError"> - <dc:Bounds x="713" y="508" width="100" height="80" /> + <dc:Bounds x="1303" y="784" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0fuugr9_di" bpmnElement="SubProcess_0fuugr9" isExpanded="true"> - <dc:Bounds x="515" y="792" width="404" height="165" /> + <dc:Bounds x="1105" y="1068" width="404" height="165" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_15qkxd7_di" bpmnElement="StartEvent_runtimeError"> - <dc:Bounds x="570" y="857" width="36" height="36" /> + <dc:Bounds x="1160" y="1133" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="577" y="900" width="24" height="12" /> + <dc:Bounds x="1167" y="1176" width="24" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1p4kxh2_di" bpmnElement="ServiceTask_HandleRuntimeError"> - <dc:Bounds x="690" y="835" width="100" height="80" /> + <dc:Bounds x="1280" y="1111" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_09e3lu5_di" bpmnElement="EndEvent__runtimeError"> - <dc:Bounds x="856" y="857" width="36" height="36" /> + <dc:Bounds x="1446" y="1133" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="784" y="897" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w"> - <di:waypoint xsi:type="dc:Point" x="606" y="875" /> - <di:waypoint xsi:type="dc:Point" x="690" y="875" /> + <di:waypoint x="1196" y="1151" /> + <di:waypoint x="1280" y="1151" /> <bpmndi:BPMNLabel> <dc:Bounds x="603" y="854" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88"> - <di:waypoint xsi:type="dc:Point" x="790" y="875" /> - <di:waypoint xsi:type="dc:Point" x="856" y="875" /> + <di:waypoint x="1380" y="1151" /> + <di:waypoint x="1446" y="1151" /> <bpmndi:BPMNLabel> <dc:Bounds x="778" y="854" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0e2p0xs_di" bpmnElement="ServiceTask_0e2p0xs"> - <dc:Bounds x="400" y="80" width="100" height="80" /> + <dc:Bounds x="990" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im"> - <di:waypoint xsi:type="dc:Point" x="500" y="120" /> - <di:waypoint xsi:type="dc:Point" x="560" y="120" /> + <di:waypoint x="1090" y="396" /> + <di:waypoint x="1150" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="530" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen"> - <di:waypoint xsi:type="dc:Point" x="1085" y="190" /> - <di:waypoint xsi:type="dc:Point" x="1085" y="246" /> - <di:waypoint xsi:type="dc:Point" x="1161" y="246" /> + <di:waypoint x="1675" y="466" /> + <di:waypoint x="1675" y="522" /> + <di:waypoint x="1751" y="522" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1091" y="218" width="19" height="12" /> + <dc:Bounds x="1682" y="494" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf"> - <di:waypoint xsi:type="dc:Point" x="180" y="120" /> - <di:waypoint xsi:type="dc:Point" x="211" y="120" /> - <di:waypoint xsi:type="dc:Point" x="211" y="120" /> - <di:waypoint xsi:type="dc:Point" x="239" y="120" /> + <di:waypoint x="770" y="396" /> + <di:waypoint x="801" y="396" /> + <di:waypoint x="801" y="396" /> + <di:waypoint x="829" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="226" y="120" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0m5xr0e_di" bpmnElement="Task_PreValidateWorkflow"> - <dc:Bounds x="80" y="80" width="100" height="80" /> + <dc:Bounds x="670" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0lbkcyp_di" bpmnElement="ServiceTask_0lbkcyp"> - <dc:Bounds x="735" y="80" width="100" height="80" /> + <dc:Bounds x="1325" y="356" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1"> - <di:waypoint xsi:type="dc:Point" x="660" y="120" /> - <di:waypoint xsi:type="dc:Point" x="735" y="120" /> + <di:waypoint x="1250" y="396" /> + <di:waypoint x="1325" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="697.5" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk"> - <di:waypoint xsi:type="dc:Point" x="835" y="120" /> - <di:waypoint xsi:type="dc:Point" x="911" y="120" /> + <di:waypoint x="1425" y="396" /> + <di:waypoint x="1501" y="396" /> <bpmndi:BPMNLabel> <dc:Bounds x="873" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim"> - <di:waypoint xsi:type="dc:Point" x="886" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="289" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="289" y="80" /> + <di:waypoint x="1476" y="240" /> + <di:waypoint x="879" y="240" /> + <di:waypoint x="879" y="356" /> <bpmndi:BPMNLabel> <dc:Bounds x="587.5" y="-57" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1dez26n_di" bpmnElement="ExclusiveGateway_1dez26n" isMarkerVisible="true"> - <dc:Bounds x="105" y="-61" width="50" height="50" /> + <dc:Bounds x="695" y="215" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="163" y="-48" width="61" height="24" /> + <dc:Bounds x="745" y="228" width="78" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lrz41x_di" bpmnElement="SequenceFlow_1lrz41x"> - <di:waypoint xsi:type="dc:Point" x="0" y="-36" /> - <di:waypoint xsi:type="dc:Point" x="105" y="-36" /> + <di:waypoint x="590" y="240" /> + <di:waypoint x="695" y="240" /> <bpmndi:BPMNLabel> <dc:Bounds x="52.5" y="-57" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0etawv5_di" bpmnElement="SequenceFlow_0etawv5"> - <di:waypoint xsi:type="dc:Point" x="130" y="-11" /> - <di:waypoint xsi:type="dc:Point" x="130" y="80" /> + <di:waypoint x="720" y="265" /> + <di:waypoint x="720" y="356" /> <bpmndi:BPMNLabel> - <dc:Bounds x="139" y="29" width="12" height="12" /> + <dc:Bounds x="729" y="305" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_12f15tu_di" bpmnElement="EndEvent_12f15tu"> - <dc:Bounds x="112" y="-169.83592938733125" width="36" height="36" /> + <dc:Bounds x="702" y="106" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="120" y="-195" width="19" height="12" /> + <dc:Bounds x="710" y="81" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ilo6lo_di" bpmnElement="SequenceFlow_0ilo6lo"> - <di:waypoint xsi:type="dc:Point" x="130" y="-61" /> - <di:waypoint xsi:type="dc:Point" x="130" y="-134" /> + <di:waypoint x="720" y="215" /> + <di:waypoint x="720" y="142" /> <bpmndi:BPMNLabel> - <dc:Bounds x="136" y="-103" width="19" height="12" /> + <dc:Bounds x="727" y="173" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 9d8b953f0e..15b91e5221 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -386,7 +386,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { return mapper.readValue(jsonstr, type) } catch (IOException e) { logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcesssError.getValue(), e) + ErrorCode.BusinessProcessError.getValue(), e) } return null } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index a55f32aaaa..5cbd530a93 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -3,7 +3,6 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,59 +20,24 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import java.util.Map; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.Optional; @Component public class InformDmaapClient implements JavaDelegate { - private static final Logger LOGGER = LoggerFactory.getLogger(InformDmaapClient.class); private DmaapClient dmaapClient; @Override public void execute(DelegateExecution execution) { String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); - String processBusinessKey = execution.getProcessBusinessKey(); - dmaapClient.registerForUpdate(pnfCorrelationId, - () -> runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey(processBusinessKey).correlateWithResult(), - createUpdateInfoMap(execution)); - } - - private Map<String, String> createUpdateInfoMap(DelegateExecution execution) { - Map<String, String> updateInfoMap = new HashMap<>(); - updateInfoMap.put("pnfCorrelationId", - (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID)); - getResourceInput(execution).ifPresent(resourceInput -> { - updateInfoMap.put("globalSubscriberID", resourceInput.getGlobalSubscriberId()); - updateInfoMap.put("serviceType", resourceInput.getServiceType()); - updateInfoMap.put("serviceInstanceId", resourceInput.getServiceInstanceId()); - }); - return updateInfoMap; - } - - private Optional<ResourceInput> getResourceInput(DelegateExecution execution) { - ResourceInput resourceInput = null; - if (execution.getVariable("resourceInput") != null) { - resourceInput = ResourceRequestBuilder.getJsonObject((String) execution.getVariable("resourceInput"), - ResourceInput.class); - } else { - LOGGER.warn("resourceInput value is null for correlation id: {}", - execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID)); - } - return Optional.ofNullable(resourceInput); + dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult()); } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java index bafb749e15..fd7eb153b6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -21,11 +21,9 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; -import java.util.Map; - public interface DmaapClient { - void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo); + void registerForUpdate(String pnfCorrelationId, Runnable informConsumer); Runnable unregister(String pnfCorrelationId); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index bd1a45c64d..a2c73ca639 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -23,14 +23,14 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; @@ -40,11 +40,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIObjectType; -import static org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForPnfCorrelationId.*; @Component public class PnfEventReadyDmaapClient implements DmaapClient { @@ -57,7 +52,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { private int topicListenerDelayInSeconds; private volatile ScheduledThreadPoolExecutor executor; private volatile boolean dmaapThreadListenerIsRunning; - private volatile List<Map<String, String>> listOfUpdateInfoMap; @Autowired public PnfEventReadyDmaapClient(Environment env) { @@ -70,16 +64,11 @@ public class PnfEventReadyDmaapClient implements DmaapClient { .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName")) .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId")) .build()); - listOfUpdateInfoMap = new ArrayList<>(); } @Override - public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, - Map<String, String> updateInfo) { + public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); - synchronized (listOfUpdateInfoMap) { - listOfUpdateInfoMap.add(updateInfo); - } pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer); if (!dmaapThreadListenerIsRunning) { startDmaapThreadListener(); @@ -90,16 +79,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { public synchronized Runnable unregister(String pnfCorrelationId) { logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); - synchronized (listOfUpdateInfoMap) { - for (int i = listOfUpdateInfoMap.size() - 1; i >= 0; i--) { - if (!listOfUpdateInfoMap.get(i).containsKey("pnfCorrelationId")) - continue; - String id = listOfUpdateInfoMap.get(i).get("pnfCorrelationId"); - if (id != pnfCorrelationId) - continue; - listOfUpdateInfoMap.remove(i); - } - } if (pnfCorrelationIdToThreadMap.isEmpty()) { stopDmaapThreadListener(); } @@ -132,12 +111,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { try { logger.debug("dmaap listener starts listening pnf ready dmaap topic"); HttpResponse response = httpClient.execute(getRequest); - if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { - String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); - List<String> idList = parseJsonToGelAllPnfCorrelationId(responseString); - idList.stream().findFirst().ifPresent(id -> registerClientResponse(id, responseString)); - idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); - } + getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); } finally { @@ -145,6 +119,16 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } + private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException { + if (response.getStatusLine().getStatusCode() == 200) { + String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); + if (responseString != null) { + return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString); + } + } + return Collections.emptyList(); + } + private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) { Runnable runnable = unregister(pnfCorrelationId); if (runnable != null) { @@ -152,36 +136,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { runnable.run(); } } - - private void registerClientResponse(String pnfCorrelationId, String response) { - - String customerId = null; - String serviceType = null; - String serId = null; - synchronized (listOfUpdateInfoMap) { - for (Map<String, String> map : listOfUpdateInfoMap) { - if (!map.containsKey("pnfCorrelationId")) - continue; - if (pnfCorrelationId != map.get("pnfCorrelationId")) - continue; - if (!map.containsKey("globalSubscriberID")) - continue; - if (!map.containsKey("serviceType")) - continue; - if (!map.containsKey("serviceInstanceId")) - continue; - customerId = map.get("pnfCorrelationId"); - serviceType = map.get("serviceType"); - serId = map.get("serviceInstanceId"); - } - } - if (customerId == null || serviceType == null || serId == null) - return; - AAIResourcesClient client = new AAIResourcesClient(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA, customerId, - serviceType, serId); - client.update(uri, response); - } - } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 29dca19820..7f2cd5c071 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -832,7 +832,7 @@ public class ServicePluginFactory { return mapper.readValue(jsonstr, type); } catch (IOException e) { logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } return null; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index bfaf9cfee0..c2e87d57bf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -32,7 +32,7 @@ public class CancelDmaapSubscriptionTest { private static final String TEST_PNF_CORRELATION_ID = "testPnfCorrelationId"; @Test - public void shouldCancelSubscription() throws Exception { + public void shouldCancelSubscription() { // given CancelDmaapSubscription delegate = new CancelDmaapSubscription(); DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl(); @@ -42,7 +42,7 @@ public class CancelDmaapSubscriptionTest { .thenReturn(TEST_PNF_CORRELATION_ID); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> { - }, null); + }); // when delegate.execute(delegateExecution); // then diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index 598582bfd8..0ec0ac8214 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -21,9 +21,8 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import java.util.Map; -import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import java.util.Objects; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; public class DmaapClientTestImpl implements DmaapClient { @@ -31,7 +30,7 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } @@ -47,19 +46,15 @@ public class DmaapClientTestImpl implements DmaapClient { return null; } - public String getPnfCorrelationId() { + String getPnfCorrelationId() { return pnfCorrelationId; } - public Runnable getInformConsumer() { + Runnable getInformConsumer() { return informConsumer; } - public void sendMessage() { - informConsumer.run(); - } - - public boolean haveRegisteredConsumer() { + boolean haveRegisteredConsumer() { return pnfCorrelationId != null; } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index 93a71b31ec..94aa1427a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -34,8 +34,6 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; public class InformDmaapClientTest { @Before @@ -76,41 +74,11 @@ public class InformDmaapClientTest { inOrder.verify(messageCorrelationBuilder).correlateWithResult(); } - private ResourceInput getUpdateResInputObj(String modelName) { - - String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" - + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n" - + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" - + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n" - + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" - + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" - + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n" - + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n" - + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \"" - + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" - + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" - + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" - + "\t\t\"modelCustomizationName\": \"\",\n" - + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n" - + "\t\"resourceInstancenUuid\": null,\n" - + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" - + "\t\"operationType\": \"createInstance\",\n" - + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" - + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" - + "}"; - - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class); - return resourceInputObj; - } - private DelegateExecution mockDelegateExecution() { - ResourceInput input = getUpdateResInputObj("OLT"); DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))) .thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); - when(delegateExecution.getVariable("resourceInput")).thenReturn(input.toString()); ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); RuntimeService runtimeService = mock(RuntimeService.class); @@ -118,7 +86,6 @@ public class InformDmaapClientTest { messageCorrelationBuilder = mock(MessageCorrelationBuilder.class); when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder); when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder); - return delegateExecution; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index c112d200e3..9f85feac07 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -60,5 +60,8 @@ public class Constants { public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus"; + public static final String EXT_VIRTUAL_LINKS = "extVirtualLinks"; + public static final String ADDITIONAL_PARAMS = "additionalParams"; + private Constants() {} } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java index 661fdb258b..877d065085 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java @@ -21,12 +21,17 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER; import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter; import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider; import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -42,14 +47,18 @@ public class InputParameterRetrieverTask { private static final Logger LOGGER = LoggerFactory.getLogger(InputParameterRetrieverTask.class); - private final InputParametersProvider inputParametersProvider; + private final InputParametersProvider<GenericVnf> sdncInputParametersProvider; private final ExtractPojosForBB extractPojosForBB; + private final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider; + @Autowired - public InputParameterRetrieverTask(final InputParametersProvider inputParametersProvider, + public InputParameterRetrieverTask(final InputParametersProvider<GenericVnf> inputParametersProvider, + final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider, final ExtractPojosForBB extractPojosForBB) { - this.inputParametersProvider = inputParametersProvider; + this.sdncInputParametersProvider = inputParametersProvider; + this.userParamInputParametersProvider = userParamInputParametersProvider; this.extractPojosForBB = extractPojosForBB; } @@ -57,17 +66,56 @@ public class InputParameterRetrieverTask { try { LOGGER.debug("Executing getInputParameters ..."); - final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); - final InputParameter inputParameter = inputParametersProvider.getInputParameter(vnf); + final InputParameter inputParameter = new InputParameter(); + + final InputParameter userParamsInputParameter = getUserParamsInputParameter(execution); + final InputParameter sdncInputParameter = getSdncInputParameter(execution); + + inputParameter.putAdditionalParams(sdncInputParameter.getAdditionalParams()); + inputParameter.addExtVirtualLinks(sdncInputParameter.getExtVirtualLinks()); + + inputParameter.putAdditionalParams(userParamsInputParameter.getAdditionalParams()); + inputParameter.addExtVirtualLinks(userParamsInputParameter.getExtVirtualLinks()); LOGGER.debug("inputParameter: {}", inputParameter); execution.setVariable(INPUT_PARAMETER, inputParameter); LOGGER.debug("Finished executing getInputParameters ..."); } catch (final Exception exception) { - LOGGER.error("Unable to invoke create and instantiation request", exception); + LOGGER.error("Unable to get input parameters", exception); execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE); } } + private InputParameter getSdncInputParameter(final BuildingBlockExecution execution) + throws BBObjectNotFoundException { + final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); + return sdncInputParametersProvider.getInputParameter(vnf); + } + + private InputParameter getUserParamsInputParameter(final BuildingBlockExecution execution) { + final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock(); + + if (generalBuildingBlock != null && generalBuildingBlock.getRequestContext() != null + && generalBuildingBlock.getRequestContext().getRequestParameters() != null) { + + final List<Map<String, Object>> userParams = + generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams(); + if (userParams != null) { + final Map<String, Object> params = new HashMap<>(); + + userParams.stream().forEach(obj -> { + params.putAll(obj); + }); + LOGGER.info("User params found : {}", params); + if (userParams != null && !userParams.isEmpty()) { + return userParamInputParametersProvider.getInputParameter(params); + } + } + + } + LOGGER.warn("No input parameters found in userparams ..."); + return NullInputParameter.NULL_INSTANCE; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/AbstractInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/AbstractInputParametersProvider.java new file mode 100644 index 0000000000..5cd84a2e11 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/AbstractInputParametersProvider.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.ADDITIONAL_PARAMS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_VIRTUAL_LINKS; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author Waqas Ikram (waqas.ikram@ericsson.com) + * + */ +public abstract class AbstractInputParametersProvider<T> implements InputParametersProvider<T> { + + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractInputParametersProvider.class); + + protected Map<String, String> parseAdditionalParameters(final String additionalParamsString) { + try { + final ObjectMapper mapper = new ObjectMapper(); + final TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String, String>>() {}; + return mapper.readValue(additionalParamsString, typeRef); + } catch (final Exception exception) { + LOGGER.error("Unable to parse {} ", ADDITIONAL_PARAMS, exception); + } + return Collections.emptyMap(); + + } + + protected List<ExternalVirtualLink> parseExternalVirtualLinks(final String extVirtualLinksString) { + try { + final ObjectMapper mapper = new ObjectMapper(); + final TypeReference<List<ExternalVirtualLink>> extVirtualLinksStringTypeRef = + new TypeReference<List<ExternalVirtualLink>>() {}; + return mapper.readValue(extVirtualLinksString, extVirtualLinksStringTypeRef); + } catch (final Exception exception) { + LOGGER.error("Unable to parse {} ", EXT_VIRTUAL_LINKS, exception); + } + return Collections.emptyList(); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java index d01d494c58..fde69c7e91 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; /** @@ -39,6 +41,8 @@ public class InputParameter implements Serializable { private List<ExternalVirtualLink> extVirtualLinks = new ArrayList<>(); + public InputParameter() {} + public InputParameter(final Map<String, String> additionalParams, final List<ExternalVirtualLink> extVirtualLinks) { this.additionalParams = additionalParams; this.extVirtualLinks = extVirtualLinks; @@ -65,6 +69,12 @@ public class InputParameter implements Serializable { this.additionalParams = additionalParams; } + public void putAdditionalParams(final Map<String, String> additionalParams) { + if (additionalParams != null) { + this.additionalParams.putAll(additionalParams); + } + } + /** * @param extVirtualLinks the extVirtualLinks to set */ @@ -72,9 +82,17 @@ public class InputParameter implements Serializable { this.extVirtualLinks = extVirtualLinks; } + public void addExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) { + if (extVirtualLinks != null) { + this.extVirtualLinks = Stream.concat(this.extVirtualLinks.stream(), extVirtualLinks.stream()).distinct() + .collect(Collectors.toList()); + } + } + @Override public String toString() { - return "InputParameter [additionalParams=" + additionalParams + ", extVirtualLinks=" + extVirtualLinks + "]"; + return this.getClass().getSimpleName() + " [additionalParams=" + additionalParams + ", extVirtualLinks=" + + extVirtualLinks + "]"; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java index 55203fb7cc..2d11143fff 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java @@ -19,13 +19,11 @@ */ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; - /** * @author waqas.ikram@est.tech */ -public interface InputParametersProvider { +public interface InputParametersProvider<T> { - InputParameter getInputParameter(final GenericVnf genericVnf); + InputParameter getInputParameter(final T object); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java index fb877ac55d..2eed224eb7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java @@ -20,12 +20,18 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; /** * @author waqas.ikram@est.tech */ public class NullInputParameter extends InputParameter { + private static final String ERROR = + "method should not be called for null object " + NullInputParameter.class.getSimpleName(); + private static final long serialVersionUID = -7261286746726871696L; public static final NullInputParameter NULL_INSTANCE = new NullInputParameter(); @@ -34,4 +40,23 @@ public class NullInputParameter extends InputParameter { super(Collections.emptyMap(), Collections.emptyList()); } + @Override + public void setAdditionalParams(final Map<String, String> additionalParams) { + throw new UnsupportedOperationException("setAdditionalParams() " + ERROR); + } + + @Override + public void setExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) { + throw new UnsupportedOperationException("setExtVirtualLinks() " + ERROR); + } + + @Override + public void addExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) { + throw new UnsupportedOperationException("addExtVirtualLinks() " + ERROR); + } + + @Override + public void putAdditionalParams(final Map<String, String> additionalParams) { + throw new UnsupportedOperationException("putAdditionalParams() " + ERROR); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java index bf4f16b355..7d81f4d5c2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java @@ -19,6 +19,8 @@ */ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.ADDITIONAL_PARAMS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_VIRTUAL_LINKS; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL; import java.io.IOException; @@ -35,8 +37,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; import net.minidev.json.JSONArray; @@ -48,18 +48,16 @@ import net.minidev.json.JSONArray; * @author waqas.ikram@est.tech */ @Service -public class InputParametersProviderImpl implements InputParametersProvider { +public class SdncInputParametersProvider extends AbstractInputParametersProvider<GenericVnf> { - private static final Logger LOGGER = LoggerFactory.getLogger(InputParametersProviderImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SdncInputParametersProvider.class); - private static final String EXT_VIRTUAL_LINKS = "extVirtualLinks"; - private static final String ADDITIONAL_PARAMS = "additionalParams"; private static final String VNF_PARAMETERS_PATH = "$..vnf-parameters"; private final SDNCClient sdncClient; @Autowired - public InputParametersProviderImpl(final SDNCClient sdncClient) { + public SdncInputParametersProvider(final SDNCClient sdncClient) { this.sdncClient = sdncClient; } @@ -80,8 +78,11 @@ public class InputParametersProviderImpl implements InputParametersProvider { if (vnfParametersObject instanceof JSONArray) { final JSONArray vnfParameters = (JSONArray) vnfParametersObject; final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters); - return new InputParameter(getAdditionalParameters(vnfParametersMap), - getExtVirtualLinks(vnfParametersMap)); + final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap); + final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap); + final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks); + LOGGER.info("InputParameter found in sdnc response : {}", inputParameter); + return inputParameter; } } } @@ -93,39 +94,24 @@ public class InputParametersProviderImpl implements InputParametersProvider { } - private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap) - throws JsonParseException, IOException { - try { - final String extVirtualLinksString = vnfParametersMap.get(EXT_VIRTUAL_LINKS); - - if (extVirtualLinksString != null && !extVirtualLinksString.isEmpty()) { - final ObjectMapper mapper = new ObjectMapper(); - final TypeReference<List<ExternalVirtualLink>> extVirtualLinksStringTypeRef = - new TypeReference<List<ExternalVirtualLink>>() {}; + private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap) { + final String extVirtualLinksString = vnfParametersMap.get(EXT_VIRTUAL_LINKS); - return mapper.readValue(extVirtualLinksString, extVirtualLinksStringTypeRef); - } - } catch (final Exception exception) { - LOGGER.error("Unable to parse {} ", EXT_VIRTUAL_LINKS, exception); + if (extVirtualLinksString != null && !extVirtualLinksString.isEmpty()) { + return parseExternalVirtualLinks(extVirtualLinksString); } return Collections.emptyList(); } - private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap) - throws JsonParseException, IOException { - try { - final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS); - if (additionalParamsString != null && !additionalParamsString.isEmpty()) { - final ObjectMapper mapper = new ObjectMapper(); - final TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String, String>>() {}; - return mapper.readValue(additionalParamsString, typeRef); - } - } catch (final Exception exception) { - LOGGER.error("Unable to parse {} ", ADDITIONAL_PARAMS, exception); + private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap) { + final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS); + if (additionalParamsString != null && !additionalParamsString.isEmpty()) { + return parseAdditionalParameters(additionalParamsString); } return Collections.emptyMap(); } + private Map<String, String> getVnfParameterMap(final JSONArray array) { try { if (array != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java new file mode 100644 index 0000000000..ac939d04ec --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.ADDITIONAL_PARAMS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_VIRTUAL_LINKS; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * @author Waqas Ikram (waqas.ikram@ericsson.com) + * + */ +@Service +public class UserParamInputParametersProvider extends AbstractInputParametersProvider<Map<String, Object>> { + private static final Logger LOGGER = LoggerFactory.getLogger(UserParamInputParametersProvider.class); + + @Override + public InputParameter getInputParameter(final Map<String, Object> userParams) { + if (userParams != null) { + final InputParameter inputParameter = new InputParameter(); + final Object additionalParams = userParams.get(ADDITIONAL_PARAMS); + + if (additionalParams != null && additionalParams instanceof String) { + inputParameter.setAdditionalParams(parseAdditionalParameters(additionalParams.toString())); + } + + final Object extVirtualLinks = userParams.get(EXT_VIRTUAL_LINKS); + if (extVirtualLinks != null && extVirtualLinks instanceof String) { + inputParameter.setExtVirtualLinks(parseExternalVirtualLinks(extVirtualLinks.toString())); + } + LOGGER.info("InputParameter found in userParams : {}", inputParameter); + return inputParameter; + } + LOGGER.warn("No input parameters found ..."); + return NullInputParameter.NULL_INSTANCE; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java index 922b721098..30e2c94ac6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.audit; -import java.util.List; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -32,10 +31,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.db.request.beans.RequestProcessingData; -import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/VnfNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/VnfNotFoundException.java new file mode 100644 index 0000000000..e1c2e01832 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/VnfNotFoundException.java @@ -0,0 +1,7 @@ +package org.onap.so.bpmn.infrastructure.flowspecific.exceptions; + +public class VnfNotFoundException extends Exception { + public VnfNotFoundException(String modelCustomizationUuidOfSearchedVnf) { + super("Can not find vnf for model customization uuid: " + modelCustomizationUuidOfSearchedVnf); + }; +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index e73a504291..3a69d27f32 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -22,11 +22,13 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -127,12 +129,12 @@ public class ConfigAssignVnf { return getServiceObjectFromServiceMap(serviceMap); } - private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws Exception { + private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get("service")); try { return objectMapper.readValue(serviceFromJson, Service.class); - } catch (Exception e) { + } catch (IOException e) { logger.error(String.format( "An exception occurred while converting json object to Service object. The json is: %s", serviceFromJson), e); @@ -141,15 +143,14 @@ public class ConfigAssignVnf { } private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid) - throws Exception { + throws VnfNotFoundException { Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream() .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid)) .findFirst(); if (foundedVnf.isPresent()) { return foundedVnf.get().getInstanceParams(); } else { - throw new Exception(String.format("Can not find vnf for genericVnfModelCustomizationUuid: %s", - genericVnfModelCustomizationUuid)); + throw new VnfNotFoundException(genericVnfModelCustomizationUuid); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index 3383fde0a8..e55fa9e24b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -102,6 +102,9 @@ public class SDNCRequestTasks { String asyncRequest = (String) execution.getVariable(request.getCorrelationName() + MESSAGE); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(new StringReader(asyncRequest))); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 11c6455474..58bf17f08b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -71,11 +71,13 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestInfo; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.VfModules; @@ -182,27 +184,15 @@ public class WorkflowAction { execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true); ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); RequestDetails requestDetails = sIRequest.getRequestDetails(); - String cloudOwner = ""; - try { - cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner(); - } catch (Exception ex) { - logger.error("Exception in getCloundOwner", ex); - cloudOwner = environment.getProperty(defaultCloudOwner); - } - boolean suppressRollback = false; - try { - suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); - } catch (Exception ex) { - logger.error("Exception in getSuppressRollback", ex); - suppressRollback = false; - } - execution.setVariable("suppressRollback", suppressRollback); + execution.setVariable("suppressRollback", isSuppressRollback(requestDetails.getRequestInfo())); boolean isResume = false; if (isUriResume(uri)) { isResume = true; - logger.debug("replacing URI {}", uri); - uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl(); - logger.debug("for RESUME with original value {}", uri); + if (!aLaCarte) { + logger.debug("replacing URI {}", uri); + uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl(); + logger.debug("for RESUME with original value {}", uri); + } } Resource resource = extractResourceIdAndTypeFromUri(uri); WorkflowType resourceType = resource.getResourceType(); @@ -234,6 +224,7 @@ public class WorkflowAction { "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found"); } } else { + String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration()); if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, @@ -344,8 +335,14 @@ public class WorkflowAction { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType); } - flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, - resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails); + boolean vnfReplace = false; + if (resourceType.equals(WorkflowType.VNF) && ("replaceInstance".equalsIgnoreCase(requestAction) + || "replaceInstanceRetainAssignments".equalsIgnoreCase(requestAction))) { + vnfReplace = true; + } + flowsToExecute = + buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, vnfReplace); if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) .collect(Collectors.toList()).isEmpty()) { logger.info("Sorting for Vlan Tagging"); @@ -410,6 +407,21 @@ public class WorkflowAction { } } + private String getCloudOwner(CloudConfiguration cloudConfiguration) { + if (cloudConfiguration != null && cloudConfiguration.getCloudOwner() != null) { + return cloudConfiguration.getCloudOwner(); + } + logger.warn("cloud owner value not found in request details, it will be set as default"); + return environment.getProperty(defaultCloudOwner); + } + + private boolean isSuppressRollback(RequestInfo requestInfo) { + if (requestInfo != null) { + return requestInfo.getSuppressRollback(); + } + return false; + } + protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) { List<T> vnfcs = new ArrayList<>(); @@ -1125,8 +1137,8 @@ public class WorkflowAction { } protected Resource extractResourceIdAndTypeFromUri(String uri) { - Pattern patt = Pattern.compile( - "[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$"); + Pattern patt = Pattern.compile("[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)?$"); Matcher m = patt.matcher(uri); Boolean generated = false; @@ -1396,13 +1408,15 @@ public class WorkflowAction { protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, WorkflowResourceIds workflowResourceIds, - RequestDetails requestDetails) { + RequestDetails requestDetails, boolean replaceVnf) { List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); for (OrchestrationFlow orchFlow : orchFlows) { if (orchFlow.getFlowName().contains(SERVICE)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) .collect(Collectors.toList()).size(); i++) { - workflowResourceIds.setServiceInstanceId(resourceId); + if (!replaceVnf) { + workflowResourceIds.setServiceInstanceId(resourceId); + } flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) .collect(Collectors.toList()).get(i), diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index ebebae3cce..293bcf9f0e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -52,6 +52,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class VnfAdapterObjectMapper { private ObjectMapper mapper = new ObjectMapper(); + private static final String ENABLE_BRIDGE = "mso.bridgeEnabled"; @PostConstruct public void init() { @@ -86,6 +87,10 @@ public class VnfAdapterObjectMapper { createVolumeGroupRequest.setMessageId(messageId); createVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId)); + String enableBridge = getProperty(ENABLE_BRIDGE); + if (enableBridge == null || Boolean.valueOf(enableBridge)) { + createVolumeGroupRequest.setEnableBridge(true); + } return createVolumeGroupRequest; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 685531e9a7..9857adbd09 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -68,6 +68,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassign import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -95,6 +96,7 @@ import com.google.common.base.Joiner; public class VnfAdapterVfModuleObjectMapper { @Autowired protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils; + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleObjectMapper.class); private static List<String> sdncResponseParamsToSkip = asList("vnf_id", "vf_module_id", "vnf_name", "vf_module_name"); @@ -114,6 +116,7 @@ public class VnfAdapterVfModuleObjectMapper { private static final String FLOATING_IP = "_floating_ip"; private static final String FLOATING_V6_IP = "_floating_v6_ip"; private static final String UNDERSCORE = "_"; + private static final String ENABLE_BRIDGE = "mso.bridgeEnabled"; @PostConstruct public void init() { @@ -160,6 +163,11 @@ public class VnfAdapterVfModuleObjectMapper { createVfModuleRequest .setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId)); + String enableBridge = getProperty(ENABLE_BRIDGE); + if (enableBridge == null || Boolean.valueOf(enableBridge)) { + createVfModuleRequest.setEnableBridge(true); + } + return createVfModuleRequest; } @@ -916,4 +924,8 @@ public class VnfAdapterVfModuleObjectMapper { } return baseVfModule; } + + protected String getProperty(String key) { + return UrnPropertiesReader.getVariable(key); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java deleted file mode 100644 index caae90bfff..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; -import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; -import org.onap.so.client.exception.BBObjectNotFoundException; - -/** - * @author waqas.ikram@est.tech - */ -public class InputParameterRetrieverTaskTest extends BaseTaskTest { - - private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); - - @Mock - private InputParametersProvider inputParametersProvider; - - @Test - public void testGGetInputParameters_inputParameterStoredInExecutionContext() throws BBObjectNotFoundException { - final InputParameterRetrieverTask objUnderTest = - new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB); - - final InputParameter inputParameter = new InputParameter(Collections.emptyMap(), Collections.emptyList()); - when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter); - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf()); - objUnderTest.getInputParameters(stubbedxecution); - - final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER); - assertNotNull(actual); - assertTrue(actual instanceof InputParameter); - } - - @Test - public void testGGetInputParameters_ThrowExecption_NullInputParameterStoredInExecutionContext() - throws BBObjectNotFoundException { - final InputParameterRetrieverTask objUnderTest = - new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB); - - when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))) - .thenThrow(RuntimeException.class); - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf()); - objUnderTest.getInputParameters(stubbedxecution); - - final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER); - assertNotNull(actual); - assertTrue(actual instanceof NullInputParameter); - } - - - private class StubbedBuildingBlockExecution implements BuildingBlockExecution { - - private final Map<String, Serializable> execution = new HashMap<>(); - - @Override - public GeneralBuildingBlock getGeneralBuildingBlock() { - return null; - } - - @SuppressWarnings("unchecked") - @Override - public <T> T getVariable(final String key) { - return (T) execution.get(key); - } - - @Override - public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception { - return null; - } - - @Override - public void setVariable(final String key, final Serializable value) { - execution.put(key, value); - } - - @Override - public Map<ResourceKey, String> getLookupMap() { - return Collections.emptyMap(); - } - - @Override - public String getFlowToBeCalled() { - return null; - } - - @Override - public int getCurrentSequence() { - return 0; - } - - } -} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java index 7b63e5f811..686b4f80cc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java @@ -20,9 +20,11 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_URL; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.ADDITIONAL_PARAMS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_VIRTUAL_LINKS; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigProvider; /** * @author waqas.ikram@est.tech @@ -30,6 +32,7 @@ import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigPro */ public class TestConstants { + public static final String EXT_VIRTUAL_LINK_ID = "ac1ed33d-8dc1-4800-8ce8-309b99c38eec"; public static final String DUMMY_GENERIC_VND_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb"; public static final String DUMMY_BASIC_AUTH = "Basic 123abc"; public static final String DUMMY_URL = "http://localhost:30406/so/vnfm-adapter/v1/"; @@ -38,6 +41,19 @@ public class TestConstants { public static final String DUMMY_JOB_ID = UUID.randomUUID().toString(); public static final String JOB_STATUS_EXPECTED_URL = DUMMY_URL + "jobs/" + DUMMY_JOB_ID; + public static final String EXT_VIRTUAL_LINK_VALUE = "{\"id\":\"" + EXT_VIRTUAL_LINK_ID + "\"," + + "\"tenant\":{\"cloudOwner\":\"CloudOwner\",\"regionName\":\"RegionOne\"," + + "\"tenantId\":\"80c26954-2536-4bca-9e20-10f8a2c9c2ad\"},\"resourceId\":\"8ef8cd54-75fd-4372-a6dd-2e05ea8fbd9b\"," + + "\"extCps\":[{\"cpdId\":\"f449292f-2f0f-4656-baa3-a18d86bac80f\"," + + "\"cpConfig\":[{\"cpInstanceId\":\"07876709-b66f-465c-99a7-0f4d026197f2\"," + + "\"linkPortId\":null,\"cpProtocolData\":null}]}],\"extLinkPorts\":null}"; + + public static final String ADDITIONAL_PARAMS_VALUE = "{\"image_id\": \"DUMMYVNF\",\"instance_type\": \"m1.small\"," + + "\"ftp_address\": \"ftp://0.0.0.0:2100/\"}"; + + public static final String EXT_VIRTUAL_LINKS_VALUE = "[" + EXT_VIRTUAL_LINK_VALUE + "]"; + + public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider() { return getVnfmBasicHttpConfigProvider(DUMMY_URL, DUMMY_BASIC_AUTH); } @@ -49,6 +65,14 @@ public class TestConstants { return vnfmBasicHttpConfigProvider; } + public static Map<String, Object> getUserParamsMap(final String additionalParams, + final String extVirtualLinksValue) { + final Map<String, Object> userParams = new HashMap<>(); + userParams.put(ADDITIONAL_PARAMS, additionalParams); + userParams.put(EXT_VIRTUAL_LINKS, extVirtualLinksValue); + return userParams; + } + private TestConstants() {} } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterRetrieverTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterRetrieverTaskTest.java new file mode 100644 index 0000000000..9003510be7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterRetrieverTaskTest.java @@ -0,0 +1,248 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.ADDITIONAL_PARAMS_VALUE; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINKS_VALUE; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINK_ID; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getUserParamsMap; +import java.io.Serializable; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants; +import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.InputParameterRetrieverTask; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLinkCpConfig; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLinkExtCps; + +/** + * @author waqas.ikram@est.tech + */ +public class InputParameterRetrieverTaskTest extends BaseTaskTest { + + private static final String INSTANCE_TYPE_VALUE_1 = "m1.small"; + + private static final String INSTANCE_TYPE_VALUE_2 = "m1.large"; + + private static final String INSTANCE_TYPE = "instance_type"; + + private static final String RANDOM_EXT_VIRTUAL_LINK_ID = UUID.randomUUID().toString(); + + private static final String CPU_INSTANCE_ID = EXT_VIRTUAL_LINK_ID; + + private static final String FLAVOR_VALUE = "ubuntu"; + + private static final String FLAVOR = "flavor_type"; + + private final StubbedBuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); + + @Mock + private InputParametersProvider<GenericVnf> sdncInputParametersProvider; + + private final InputParametersProvider<Map<String, Object>> userParamsinputParametersProvider = + new UserParamInputParametersProvider(); + + @Mock + private SDNCClient mockedSdncClient; + + @Test + public void testGetInputParameters_inputParameterStoredInExecutionContext() throws BBObjectNotFoundException { + final InputParameterRetrieverTask objUnderTest = new InputParameterRetrieverTask(sdncInputParametersProvider, + userParamsinputParametersProvider, extractPojosForBB); + + + final GeneralBuildingBlock buildingBlock = + getGeneralBuildingBlock(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, null)); + stubbedxecution.setGeneralBuildingBlock(buildingBlock); + + final InputParameter inputParameter = new InputParameter(Collections.emptyMap(), Collections.emptyList()); + when(sdncInputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf()); + objUnderTest.getInputParameters(stubbedxecution); + + final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER); + assertNotNull(actual); + assertTrue(actual instanceof InputParameter); + final InputParameter actualInputParameter = (InputParameter) actual; + final Map<String, String> actualAdditionalParams = actualInputParameter.getAdditionalParams(); + assertEquals(3, actualAdditionalParams.size()); + + final String actualInstanceType = actualAdditionalParams.get(INSTANCE_TYPE); + assertEquals(INSTANCE_TYPE_VALUE_1, actualInstanceType); + + } + + @Test + public void testGetInputParameters_ThrowExecption_NullInputParameterStoredInExecutionContext() + throws BBObjectNotFoundException { + final InputParameterRetrieverTask objUnderTest = new InputParameterRetrieverTask(sdncInputParametersProvider, + userParamsinputParametersProvider, extractPojosForBB); + + when(sdncInputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))) + .thenThrow(RuntimeException.class); + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf()); + objUnderTest.getInputParameters(stubbedxecution); + + final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER); + assertNotNull(actual); + assertTrue(actual instanceof NullInputParameter); + } + + @Test + public void testGetInputParameters_SdncAndUserParamInputParameterStoredInExecutionContext() + throws BBObjectNotFoundException { + final InputParameterRetrieverTask objUnderTest = new InputParameterRetrieverTask(sdncInputParametersProvider, + userParamsinputParametersProvider, extractPojosForBB); + + + final GeneralBuildingBlock buildingBlock = + getGeneralBuildingBlock(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINKS_VALUE)); + stubbedxecution.setGeneralBuildingBlock(buildingBlock); + + final InputParameter inputParameter = new InputParameter(getAdditionalParams(), getExternalVirtualLink()); + when(sdncInputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf()); + objUnderTest.getInputParameters(stubbedxecution); + + final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER); + assertNotNull(actual); + assertTrue(actual instanceof InputParameter); + final InputParameter actualInputParameter = (InputParameter) actual; + final Map<String, String> actualAdditionalParams = actualInputParameter.getAdditionalParams(); + assertEquals(4, actualAdditionalParams.size()); + + final String actualInstanceType = actualAdditionalParams.get(INSTANCE_TYPE); + assertEquals(INSTANCE_TYPE_VALUE_1, actualInstanceType); + + assertEquals(FLAVOR_VALUE, actualAdditionalParams.get(FLAVOR)); + final List<ExternalVirtualLink> actualExtVirtualLinks = actualInputParameter.getExtVirtualLinks(); + assertEquals(2, actualExtVirtualLinks.size()); + + final Optional<ExternalVirtualLink> externalVirtualLink0 = actualExtVirtualLinks.stream() + .filter(extVirtualLink -> EXT_VIRTUAL_LINK_ID.equals(extVirtualLink.getId())).findAny(); + assertTrue(externalVirtualLink0.isPresent()); + assertEquals(EXT_VIRTUAL_LINK_ID, externalVirtualLink0.get().getId()); + + final Optional<ExternalVirtualLink> externalVirtualLink1 = actualExtVirtualLinks.stream() + .filter(extVirtualLink -> RANDOM_EXT_VIRTUAL_LINK_ID.equals(extVirtualLink.getId())).findAny(); + assertTrue(externalVirtualLink1.isPresent()); + assertEquals(RANDOM_EXT_VIRTUAL_LINK_ID, externalVirtualLink1.get().getId()); + + + } + + private List<ExternalVirtualLink> getExternalVirtualLink() { + return Arrays.asList( + new ExternalVirtualLink().id(RANDOM_EXT_VIRTUAL_LINK_ID).addExtCpsItem(new ExternalVirtualLinkExtCps() + .addCpConfigItem(new ExternalVirtualLinkCpConfig().cpInstanceId(CPU_INSTANCE_ID)))); + } + + private Map<String, String> getAdditionalParams() { + final Map<String, String> additionalParams = new HashMap<>(); + additionalParams.put(FLAVOR, FLAVOR_VALUE); + additionalParams.put(INSTANCE_TYPE, INSTANCE_TYPE_VALUE_2); + return additionalParams; + } + + + private GeneralBuildingBlock getGeneralBuildingBlock(final Map<String, Object> userParams) { + final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock(); + final RequestContext requestContext = new RequestContext(); + final RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(Arrays.asList(userParams)); + requestContext.setRequestParameters(requestParameters); + buildingBlock.setRequestContext(requestContext); + return buildingBlock; + + } + + private class StubbedBuildingBlockExecution implements BuildingBlockExecution { + + private final Map<String, Serializable> execution = new HashMap<>(); + private GeneralBuildingBlock buildingBlock; + + private void setGeneralBuildingBlock(final GeneralBuildingBlock buildingBlock) { + this.buildingBlock = buildingBlock; + } + + @Override + public GeneralBuildingBlock getGeneralBuildingBlock() { + return buildingBlock; + } + + @SuppressWarnings("unchecked") + @Override + public <T> T getVariable(final String key) { + return (T) execution.get(key); + } + + @Override + public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception { + return null; + } + + @Override + public void setVariable(final String key, final Serializable value) { + execution.put(key, value); + } + + @Override + public Map<ResourceKey, String> getLookupMap() { + return Collections.emptyMap(); + } + + @Override + public String getFlowToBeCalled() { + return null; + } + + @Override + public int getCurrentSequence() { + return 0; + } + + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterTest.java new file mode 100644 index 0000000000..6dee904fde --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameterTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.junit.Test; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; + +/** + * @author Waqas Ikram (waqas.ikram@ericsson.com) + * + */ +public class InputParameterTest { + @Test + public void test_putAdditionalParams_addsEntryToExistingMap() { + final InputParameter objUnderTest = new InputParameter(); + objUnderTest.setAdditionalParams(getMap("name", "value")); + objUnderTest.putAdditionalParams(getMap("name1", "value1")); + + final Map<String, String> additionalParams = objUnderTest.getAdditionalParams(); + assertEquals(2, additionalParams.size()); + assertTrue(additionalParams.containsKey("name")); + assertTrue(additionalParams.containsKey("name1")); + + } + + @Test + public void test_addExtVirtualLinks_adddistinctEntriesToExistingList() { + final InputParameter objUnderTest = new InputParameter(); + String firstId = UUID.randomUUID().toString(); + String secondId = UUID.randomUUID().toString(); + objUnderTest.setExtVirtualLinks(getExternalVirtualLinkList(firstId)); + objUnderTest.addExtVirtualLinks(getExternalVirtualLinkList(secondId)); + objUnderTest.addExtVirtualLinks(getExternalVirtualLinkList(secondId)); + objUnderTest.addExtVirtualLinks(getExternalVirtualLinkList(secondId)); + + final List<ExternalVirtualLink> externalVirtualLinks = objUnderTest.getExtVirtualLinks(); + assertEquals(2, externalVirtualLinks.size()); + + } + + private List<ExternalVirtualLink> getExternalVirtualLinkList(final String id) { + final ExternalVirtualLink externalVirtualLink = new ExternalVirtualLink(); + externalVirtualLink.setId(id); + final List<ExternalVirtualLink> list = new ArrayList<>(); + list.add(externalVirtualLink); + return list; + } + + private Map<String, String> getMap(final String name, final String value) { + final Map<String, String> map = new HashMap<>(); + map.put(name, value); + return map; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameterTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameterTest.java new file mode 100644 index 0000000000..e076df7a9b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameterTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.junit.Assert.assertTrue; +import java.util.Collections; +import org.junit.Test; + +/** + * @author Waqas Ikram (waqas.ikram@ericsson.com) + * + */ +public class NullInputParameterTest { + + @Test(expected = UnsupportedOperationException.class) + public void test_addExtVirtualLinks_throwException() { + NullInputParameter.NULL_INSTANCE.addExtVirtualLinks(Collections.emptyList()); + } + + @Test(expected = UnsupportedOperationException.class) + public void test_setAdditionalParams_throwException() { + NullInputParameter.NULL_INSTANCE.setAdditionalParams(Collections.emptyMap()); + } + + @Test(expected = UnsupportedOperationException.class) + public void test_setExtVirtualLinks_throwException() { + NullInputParameter.NULL_INSTANCE.setExtVirtualLinks(Collections.emptyList()); + } + + @Test(expected = UnsupportedOperationException.class) + public void test_putAdditionalParams_throwException() { + NullInputParameter.NULL_INSTANCE.putAdditionalParams(Collections.emptyMap()); + } + + @Test + public void test_getAdditionalParams_ReturnEmptyCollection() { + assertTrue(NullInputParameter.NULL_INSTANCE.getAdditionalParams().isEmpty()); + } + + @Test + public void test_getExtVirtualLinks_ReturnEmptyCollection() { + assertTrue(NullInputParameter.NULL_INSTANCE.getExtVirtualLinks().isEmpty()); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProviderImplTest.java index 51e86c1fea..e2e37ac6e4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProviderImplTest.java @@ -48,7 +48,7 @@ import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; * @author waqas.ikram@est.tech */ @RunWith(MockitoJUnitRunner.class) -public class InputParametersProviderImplTest { +public class SdncInputParametersProviderImplTest { private static final String BASE_DIR = "src/test/resources/__files/"; @@ -89,7 +89,7 @@ public class InputParametersProviderImplTest { @Test public void testGetInputParameter_ValidResponseFromSdncInvalidData_EmptyInputParameter() throws Exception { when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_PRE_LOAD_SDNC_RESPONSE)); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf()); assertNotNull(actual); assertTrue(actual.getAdditionalParams().isEmpty()); @@ -99,7 +99,7 @@ public class InputParametersProviderImplTest { @Test public void testGetInputParameter_ExceptionThrownFromSdnc_EmptyInputParameter() throws Exception { when(mockedSdncClient.get(Mockito.eq(URL))).thenThrow(RuntimeException.class); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf()); assertNotNull(actual); assertTrue(actual instanceof NullInputParameter); @@ -110,7 +110,7 @@ public class InputParametersProviderImplTest { @Test public void testGetInputParameter_InvalidResponseData_EmptyInputParameter() throws Exception { when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_ADDITIONAL_AND_EXT_VM_DATA)); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf()); assertNotNull(actual); assertTrue(actual.getAdditionalParams().isEmpty()); @@ -120,7 +120,7 @@ public class InputParametersProviderImplTest { @Test public void testGetInputParameter_EmptyResponseData_EmptyInputParameter() throws Exception { when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(""); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf()); assertNotNull(actual); assertTrue(actual instanceof NullInputParameter); @@ -131,7 +131,7 @@ public class InputParametersProviderImplTest { @Test public void testGetInputParameter_InvalidVnfParamsResponseData_EmptyInputParameter() throws Exception { when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_VNF_PARAMS)); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf()); assertNotNull(actual); assertTrue(actual.getAdditionalParams().isEmpty()); @@ -140,7 +140,7 @@ public class InputParametersProviderImplTest { private void assertValues(final GenericVnf genericVnf) throws MapperException, BadResponseException, IOException { when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(PRE_LOAD_SDNC_RESPONSE)); - final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient); + final InputParametersProvider<GenericVnf> objUnderTest = new SdncInputParametersProvider(mockedSdncClient); final InputParameter actual = objUnderTest.getInputParameter(genericVnf); assertNotNull(actual); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProviderTest.java new file mode 100644 index 0000000000..e6d4ad056a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProviderTest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.ADDITIONAL_PARAMS_VALUE; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINKS_VALUE; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINK_VALUE; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getUserParamsMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; + +/** + * @author Waqas Ikram (waqas.ikram@ericsson.com) + * + */ +public class UserParamInputParametersProviderTest { + + @Test + public void testGetInputParameter_ValidUserParams_NotEmptyInputParameter() throws Exception { + final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); + + final InputParameter actual = + objUnderTest.getInputParameter(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINKS_VALUE)); + assertNotNull(actual); + + final Map<String, String> actualAdditionalParams = actual.getAdditionalParams(); + assertEquals(3, actualAdditionalParams.size()); + + final String actualInstanceType = actualAdditionalParams.get("instance_type"); + assertEquals("m1.small", actualInstanceType); + + final List<ExternalVirtualLink> actualExtVirtualLinks = actual.getExtVirtualLinks(); + assertEquals(1, actualExtVirtualLinks.size()); + + final ExternalVirtualLink actualExternalVirtualLink = actualExtVirtualLinks.get(0); + assertEquals("ac1ed33d-8dc1-4800-8ce8-309b99c38eec", actualExternalVirtualLink.getId()); + + } + + @Test + public void testGetInputParameter_EmptyOrNullUserParams_EmptyInputParameter() throws Exception { + final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); + + InputParameter actual = objUnderTest.getInputParameter(Collections.emptyMap()); + assertNotNull(actual); + assertTrue(actual.getAdditionalParams().isEmpty()); + assertTrue(actual.getExtVirtualLinks().isEmpty()); + + actual = objUnderTest.getInputParameter(null); + assertNotNull(actual); + assertTrue(actual instanceof NullInputParameter); + assertTrue(actual.getAdditionalParams().isEmpty()); + assertTrue(actual.getExtVirtualLinks().isEmpty()); + + } + + @Test + public void testGetInputParameter_InValidExtVirtualLinks_NotEmptyInputParameter() throws Exception { + final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); + + final InputParameter actual = + objUnderTest.getInputParameter(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINK_VALUE)); + assertNotNull(actual); + + final Map<String, String> actualAdditionalParams = actual.getAdditionalParams(); + assertEquals(3, actualAdditionalParams.size()); + + final String actualInstanceType = actualAdditionalParams.get("instance_type"); + assertEquals("m1.small", actualInstanceType); + + assertTrue(actual.getExtVirtualLinks().isEmpty()); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java index bbc20706a6..2d7649438e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java @@ -22,11 +22,16 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,6 +41,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -74,33 +80,63 @@ public class ConfigAssignVnfTest { private static final String INSTANCE_PARAM5_NAME = "paramName5"; private static final String INSTANCE_PARAM5_VALUE = "paramValue5"; - private ConfigAssignVnf testedObject; - private BuildingBlockExecution buildingBlockExecution; private ExtractPojosForBB extractPojosForBB; + private ExceptionBuilder exceptionBuilderMock; @Before public void setup() { - buildingBlockExecution = createBuildingBlockExecution(); extractPojosForBB = mock(ExtractPojosForBB.class); - testedObject = new ConfigAssignVnf(extractPojosForBB, new ExceptionBuilder()); + exceptionBuilderMock = mock(ExceptionBuilder.class); + testedObject = new ConfigAssignVnf(extractPojosForBB, exceptionBuilderMock); } @Test public void prepareAbstractCDSPropertiesBean_success() throws Exception { // given + BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution(createService(createVnfList())); + prepareExtractPojosForBB(buildingBlockExecution); + // when + testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); + // then + verifyConfigAssignPropertiesJsonContent(buildingBlockExecution); + } + + @Test + public void invalidServiceJsonContentWhenPrepareCDSBean_flowExIsThrown() throws Exception { + // given + BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution("{invalidJsonContent}"); + prepareExtractPojosForBB(buildingBlockExecution); + // when + testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); + // then + verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), + any(IOException.class)); + } + + @Test + public void vnfIsNotFoundWhenPrepareCDSBean_flowExIsThrown() throws Exception { + // given + BuildingBlockExecution buildingBlockExecution = + createBuildingBlockExecution(createService(Collections.emptyList())); + prepareExtractPojosForBB(buildingBlockExecution); + // when + testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); + // then + verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), + any(VnfNotFoundException.class)); + } + + private void prepareExtractPojosForBB(BuildingBlockExecution buildingBlockExecution) throws Exception { when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID)) .thenReturn(createGenericVnf()); when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID)) .thenReturn(createServiceInstance()); - // when - testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); - // then - verifyConfigAssignPropertiesJsonContent(); } - private void verifyConfigAssignPropertiesJsonContent() throws Exception { + private void verifyConfigAssignPropertiesJsonContent(BuildingBlockExecution buildingBlockExecution) + throws Exception { AbstractCDSPropertiesBean abstractCDSPropertiesBean = buildingBlockExecution.getVariable("executionObject"); String payload = abstractCDSPropertiesBean.getRequestObject(); ObjectMapper mapper = new ObjectMapper(); @@ -121,9 +157,9 @@ public class ConfigAssignVnfTest { assertThat(configAssignPropertiesNode.get(INSTANCE_PARAM3_NAME).asText()).isEqualTo(INSTANCE_PARAM3_VALUE); } - private BuildingBlockExecution createBuildingBlockExecution() { + private BuildingBlockExecution createBuildingBlockExecution(Object serviceJson) { DelegateExecution execution = new DelegateExecutionFake(); - execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock()); + execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock(serviceJson)); return new DelegateExecutionImpl(execution); } @@ -148,28 +184,28 @@ public class ConfigAssignVnfTest { return genericVnf; } - private GeneralBuildingBlock createGeneralBuildingBlock() { + private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) { GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock(); RequestContext requestContext = new RequestContext(); RequestParameters requestParameters = new RequestParameters(); - requestParameters.setUserParams(createRequestUserParams()); + requestParameters.setUserParams(createRequestUserParams(serviceJson)); requestContext.setRequestParameters(requestParameters); generalBuildingBlock.setRequestContext(requestContext); return generalBuildingBlock; } - private List<Map<String, Object>> createRequestUserParams() { + private List<Map<String, Object>> createRequestUserParams(Object serviceJson) { List<Map<String, Object>> userParams = new ArrayList<>(); Map<String, Object> userParamMap = new HashMap<>(); - userParamMap.put("service", createService()); + userParamMap.put("service", serviceJson); userParams.add(userParamMap); return userParams; } - private Service createService() { + private Service createService(List<Vnfs> vnfList) { Service service = new Service(); Resources resources = new Resources(); - resources.setVnfs(createVnfList()); + resources.setVnfs(vnfList); service.setResources(resources); return service; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index be6fc94890..6c959703e4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -927,6 +927,9 @@ public class WorkflowActionTest extends BaseTaskTest { "CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB", "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB"); + for (ExecuteBuildingBlock executeBuildingBlock : ebbs) { + assertEquals("123", executeBuildingBlock.getWorkflowResourceIds().getServiceInstanceId()); + } } @Ignore @@ -1477,6 +1480,27 @@ public class WorkflowActionTest extends BaseTaskTest { } @Test + public void extractResourceIdAndTypeFromUriReplaceResumeTest() { + Resource resource = workflowAction.extractResourceIdAndTypeFromUri( + "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/deactivateAndCloudDelete/resume"); + assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847"); + } + + @Test + public void extractResourceIdAndTypeFromUriDeActiveResumeTest() { + Resource resource = workflowAction.extractResourceIdAndTypeFromUri( + "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/replace/resume"); + assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847"); + } + + @Test + public void extractResourceIdAndTypeFromUriResumeIdOnly() { + Resource resource = workflowAction.extractResourceIdAndTypeFromUri( + "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume"); + assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847"); + } + + @Test public void isUriResumeTest() { assertTrue(workflowAction.isUriResume( "http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume")); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index 2e77023757..a482da5158 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -150,7 +150,23 @@ public class VnfAdapterObjectMapperTest { CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + + doReturn("false").when(vnfAdapterObjectMapper).getProperty("mso.bridgeEnabled"); + actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, + cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + + doReturn(null).when(vnfAdapterObjectMapper).getProperty("mso.bridgeEnabled"); + expectedCreateVolumeGroupRequest.setEnableBridge(true); + actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, + cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + doReturn("true").when(vnfAdapterObjectMapper).getProperty("mso.bridgeEnabled"); + expectedCreateVolumeGroupRequest.setEnableBridge(true); + actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, + cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java index 44a08139d6..836f8c1842 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -23,6 +23,7 @@ package org.onap.so.client.adapter.vnf.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -32,6 +33,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.Mockito; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmNetworkData; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; @@ -46,6 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.openstack.utils.MsoMulticloudUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -56,6 +59,9 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper(); private ObjectMapper omapper = new ObjectMapper(); + @Autowired + protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils; + @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -128,16 +134,35 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { String sdncVfModuleQueryResponse = new String(Files .readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + VnfAdapterVfModuleObjectMapper spyMapper = Mockito.spy(vfModuleObjectMapper); + + doReturn("false").when(spyMapper).getProperty("mso.bridgeEnabled"); CreateVfModuleRequest vfModuleVNFAdapterRequest = - vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, + spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); - CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class); + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + + doReturn("true").when(spyMapper).getProperty("mso.bridgeEnabled"); + vfModuleVNFAdapterRequest = + spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, + serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + jsonToCompare = new String(Files + .readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestBridgeEnabled.json"))); + reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class); + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + + + doReturn(null).when(spyMapper).getProperty("mso.bridgeEnabled"); + vfModuleVNFAdapterRequest = + spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, + serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + jsonToCompare = new String(Files + .readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestBridgeEnabled.json"))); + reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class); assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json index 5975cb21fe..b57c8341f1 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json @@ -13,6 +13,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestBridgeEnabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestBridgeEnabled.json new file mode 100644 index 0000000000..a02b1c901d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestBridgeEnabled.json @@ -0,0 +1,71 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": false, + "enableBridge": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value2", + "key3": "value3", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue", + "sdnc_directives": "{ \"attributes\": [ {\"attribute_name\": \"key1\", \"attribute_value\": \"value1\"}, {\"attribute_name\": \"fw_subint_ctrl_port_0_subintcount\", \"attribute_value\": \"1\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_floating_ip\", \"attribute_value\": \"floatingIpV40\"}, {\"attribute_name\": \"paramOne\", \"attribute_value\": \"paramOneValue\"}, {\"attribute_name\": \"vmType0_name_0\", \"attribute_value\": \"vmName0\"}, {\"attribute_name\": \"vnfNetworkRole0_v6_subnet_id\", \"attribute_value\": \"subnetId1\"}, {\"attribute_name\": \"vmType0_name_1\", \"attribute_value\": \"vmName1\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_ip_1\", \"attribute_value\": \"ip1\"}, {\"attribute_name\": \"vnfNetworkRole0_net_name\", \"attribute_value\": \"netName0\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_ip_0\", \"attribute_value\": \"ip0\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_vlan_ids\", \"attribute_value\": \"1\"}, {\"attribute_name\": \"vnfNetworkRole0_net_id\", \"attribute_value\": \"neutronId0\"}, {\"attribute_name\": \"availability_zone_0\", \"attribute_value\": \"zone0\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_v6_ip_1\", \"attribute_value\": \"ip3\"}, {\"attribute_name\": \"availability_zone_1\", \"attribute_value\": \"zone1\"}, {\"attribute_name\": \"fw_subint_ctrl_port_0_floating_v6_ip\", \"attribute_value\": \"floatingIpV60\"}, {\"attribute_name\": \"availability_zone_2\", \"attribute_value\": \"zone2\"}, {\"attribute_name\": \"vmType0_names\", \"attribute_value\": \"vmName0,vmName1\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_route_prefixes\", \"attribute_value\": \"[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_v6_ip_0\", \"attribute_value\": \"ip2\"}, {\"attribute_name\": \"vnfNetworkRole0_subnet_id\", \"attribute_value\": \"subnetId0\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_v6_ip_1\", \"attribute_value\": \"ip1\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_ip_1\", \"attribute_value\": \"ip1\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_ip_0\", \"attribute_value\": \"ip0\"}, {\"attribute_name\": \"vnfNetworkRole0_net_fqdn\", \"attribute_value\": \"netFqdnValue0\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_v6_ip_0\", \"attribute_value\": \"ip0\"}, {\"attribute_name\": \"vmNetworkRole0_ATT_VF_VLAN_FILTER\", \"attribute_value\": \"heatVlanFilter0,heatVlanFilter1\"}, {\"attribute_name\": \"paramTwo\", \"attribute_value\": \"paramTwoValue\"}, {\"attribute_name\": \"paramThree\", \"attribute_value\": \"paramThreeValue\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_v6_ips\", \"attribute_value\": \"ip2,ip3\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_floating_v6_ip\", \"attribute_value\": \"floatingIpV60\"}, {\"attribute_name\": \"vmType0_vmNetworkRole0_ips\", \"attribute_value\": \"ip0,ip1\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_ip\", \"attribute_value\": \"ip0,ip1\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_net_names\", \"attribute_value\": \"1\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_net_ids\", \"attribute_value\": \"networkId0\"}, {\"attribute_name\": \"fw_0_subint_ctrl_port_0_v6_ip\", \"attribute_value\": \"ip0,ip1\"}, {\"attribute_name\": \"fw_subint_ctrl_port_0_floating_ip\", \"attribute_value\": \"floatingIpV40\"}] }", + "user_directives": "{ \"attributes\": [ {\"attribute_name\": \"key1\", \"attribute_value\": \"value2\"}] }" + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json index aa4ada059d..ea51d2c6b2 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json index f7fb1e9f44..aa633bf5a8 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json index e06f9cbf36..9bddf29433 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json index b97bab4149..4ccfdbe890 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": true, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json index 7b78510f56..da826b8a89 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json index 83ba299914..3170b8ba54 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json index aaee92b083..be860ace96 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json @@ -11,6 +11,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json index a419c2ee59..54f6e403ed 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json @@ -13,6 +13,7 @@ "skipAAI": true, "backout": false, "failIfExists": false, + "enableBridge": true, "msoRequest": { "requestId": "requestId", |