diff options
Diffstat (limited to 'bpmn')
51 files changed, 3117 insertions, 2212 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 48a8e60095..a86e1de772 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 @@ -89,7 +89,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } infraRequest.setLastModifiedBy("BPMN") infraRequest.setStatusMessage(statusMessage) - infraRequest.setRequestStatus("COMPLETED") + infraRequest.setRequestStatus("COMPLETE") infraRequest.setProgress(100) if(utils.nodeExists(xml, "vnfId")){ @@ -104,7 +104,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId")) }else if(utils.nodeExists(xml, "volumeGroupId")){ infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId")) - + }else if(utils.nodeExists(xml, "pnfName")){ + infraRequest.setPnfName(utils.getNodeText(xml, "pnfName")) } dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index a6aacc7ea5..e8f842471c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -40,419 +40,419 @@ import java.util.UUID import org.onap.so.utils.Components - +@Deprecated //Use vnfAdapterRestV2 class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class); - ExceptionUtil exceptionUtil = new ExceptionUtil() + ExceptionUtil exceptionUtil = new ExceptionUtil() - // VNF Response Processing - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) + // VNF Response Processing + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + logger.trace('Entered ' + method) - def prefix="VNFREST_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) + def prefix="VNFREST_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) - try { - String request = validateRequest(execution, "mso-request-id") + try { + String request = validateRequest(execution, "mso-request-id") - // Get the request type (the name of the root element) from the request + // Get the request type (the name of the root element) from the request - Node root = new XmlParser().parseText(request) - String requestType = root.name() - execution.setVariable(prefix + 'requestType', requestType) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + Node root = new XmlParser().parseText(request) + String requestType = root.name() + execution.setVariable(prefix + 'requestType', requestType) + logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) - logger.debug('VnfAdapterRestV1, request: ' + request) - // Get the messageId from the request + logger.debug('VnfAdapterRestV1, request: ' + request) + // Get the messageId from the request - String messageId = getChildText(root, 'messageId') + String messageId = getChildText(root, 'messageId') - if ('rollbackVolumeGroupRequest'.equals(requestType)) { - messageId = getMessageIdForVolumeGroupRollback(root) - } + if ('rollbackVolumeGroupRequest'.equals(requestType)) { + messageId = getMessageIdForVolumeGroupRollback(root) + } - if (messageId == null || messageId.isEmpty()) { - String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (messageId == null || messageId.isEmpty()) { + String msg = getProcessKey(execution) + ': no messageId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - execution.setVariable('VNFAResponse_CORRELATOR', messageId) - logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId) + execution.setVariable('VNFAResponse_CORRELATOR', messageId) + logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId) - // Get the notificationUrl from the request + // Get the notificationUrl from the request - String notificationUrl = getChildText(root, 'notificationUrl') + String notificationUrl = getChildText(root, 'notificationUrl') - if (notificationUrl == null || notificationUrl.isEmpty()) { - String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (notificationUrl == null || notificationUrl.isEmpty()) { + String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - execution.setVariable(prefix + 'notificationUrl', notificationUrl) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl) + execution.setVariable(prefix + 'notificationUrl', notificationUrl) + logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl) - // Determine the VnfAdapter endpoint + // Determine the VnfAdapter endpoint - String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution) + String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution) - if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { - String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { + String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - while (vnfAdapterEndpoint.endsWith('/')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) - } + while (vnfAdapterEndpoint.endsWith('/')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) + } - String vnfAdapterMethod = null - String vnfAdapterUrl = null - String vnfAdapterRequest = request + String vnfAdapterMethod = null + String vnfAdapterUrl = null + String vnfAdapterRequest = request - if ('createVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') + if ('createVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - vnfAdapterMethod = 'POST' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' + vnfAdapterMethod = 'POST' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' - } else if ('updateVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') + } else if ('updateVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - String vfModuleId = getChildText(root, 'vfModuleId') + String vfModuleId = getChildText(root, 'vfModuleId') - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - vnfAdapterMethod = 'PUT' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + vnfAdapterMethod = 'PUT' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - } else if ('deleteVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') + } else if ('deleteVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - String vfModuleId = getChildText(root, 'vfModuleId') + String vfModuleId = getChildText(root, 'vfModuleId') - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - } else if ('rollbackVfModuleRequest'.equals(requestType)) { - Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') + } else if ('rollbackVfModuleRequest'.equals(requestType)) { + Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') - if (vfModuleRollbackNode == null) { - String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vfModuleRollbackNode == null) { + String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') + String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') + String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' - - } else if ('createVolumeGroupRequest'.equals(requestType)) { - vnfAdapterMethod = 'POST' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' - - } else if ('updateVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + } + + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' + + } else if ('createVolumeGroupRequest'.equals(requestType)) { + vnfAdapterMethod = 'POST' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' + + } else if ('updateVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - vnfAdapterMethod = 'PUT' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + vnfAdapterMethod = 'PUT' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - } else if ('deleteVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') + } else if ('deleteVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } + } - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root) + } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root) - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' - - } else { - String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + } + + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' + + } else { + String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod) - execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl) - execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest) - - // Get the Basic Auth credentials for the VnfAdapter - - String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) - - if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - ErrorCode.UnknownError.getValue()); - } else { - try { - def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) - execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) - } catch (IOException ex) { - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", - "BPMN", ErrorCode.UnknownError.getValue(), ex); - } - } - - } catch (BpmnError e) { - logger.debug(" Rethrowing MSOWorkflowException") - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - logger.debug(msg) + } + + execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) + logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod) + execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) + logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl) + execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) + logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest) + + // Get the Basic Auth credentials for the VnfAdapter + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + if (basicAuthValue == null || basicAuthValue.isEmpty()) { + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", + ErrorCode.UnknownError.getValue()); + } else { + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) + } catch (IOException ex) { + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", + "BPMN", ErrorCode.UnknownError.getValue(), ex); + } + } + + } catch (BpmnError e) { + logger.debug(" Rethrowing MSOWorkflowException") + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - } + } + } - public String getVolumeGroupIdFromRollbackRequest(Node root) { - return root.'volumeGroupRollback'.'volumeGroupId'.text() - } + public String getVolumeGroupIdFromRollbackRequest(Node root) { + return root.'volumeGroupRollback'.'volumeGroupId'.text() + } - public String getMessageIdForVolumeGroupRollback(Node root) { - return root.'volumeGroupRollback'.'messageId'.text() - } + public String getMessageIdForVolumeGroupRollback(Node root) { + return root.'volumeGroupRollback'.'messageId'.text() + } - /** - * This method is used instead of an HTTP Connector task because the - * connector does not allow DELETE with a body. - */ - public void sendRequestToVnfAdapter(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) + /** + * This method is used instead of an HTTP Connector task because the + * connector does not allow DELETE with a body. + */ + public void sendRequestToVnfAdapter(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + + 'execution=' + execution.getId() + + ')' + logger.trace('Entered ' + method) - String prefix = execution.getVariable('prefix') + String prefix = execution.getVariable('prefix') - try { - String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') - String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') - String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') + try { + String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') + String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') + String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') - URL url = new URL(vnfAdapterUrl); + URL url = new URL(vnfAdapterUrl); HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER) - httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) - - httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) - httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) - httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter") - Response response; - - if ("GET".equals(vnfAdapterMethod)) { - response = httpClient.get() - } else if ("PUT".equals(vnfAdapterMethod)) { - response = httpClient.put(vnfAdapterRequest) - } else if ("POST".equals(vnfAdapterMethod)) { - response = httpClient.post(vnfAdapterRequest) - } else if ("DELETE".equals(vnfAdapterMethod)) { - response = httpClient.delete(vnfAdapterRequest) - } else { - String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) + + httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) + httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) + httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter") + Response response; + + if ("GET".equals(vnfAdapterMethod)) { + response = httpClient.get() + } else if ("PUT".equals(vnfAdapterMethod)) { + response = httpClient.put(vnfAdapterRequest) + } else if ("POST".equals(vnfAdapterMethod)) { + response = httpClient.post(vnfAdapterRequest) + } else if ("DELETE".equals(vnfAdapterMethod)) { + response = httpClient.delete(vnfAdapterRequest) + } else { + String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) - if(response.hasEntity()){ - execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class)) - } - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + } + + execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) + if(response.hasEntity()){ + execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class)) + } + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - } - - public void processCallback(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processCallback(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) - - String callback = execution.getVariable('VNFAResponse_MESSAGE') - - try { - logger.debug(getProcessKey(execution) + ": received callback:\n" + callback) - - // The XML callback is available to the calling flow in any case, - // even if a WorkflowException is generated. - execution.setVariable(getProcessKey(execution) + 'Response', callback) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. - execution.setVariable("WorkflowResponse", callback) - - callback = utils.removeXmlPreamble(callback) - - Node root = new XmlParser().parseText(callback) - if (root.name().endsWith('Exception')) { - vnfAdapterWorkflowException(execution, callback) - } - } catch (Exception e) { - logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) + } + } + + public void processCallback(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processCallback(' + + 'execution=' + execution.getId() + + ')' + logger.trace('Entered ' + method) + + String callback = execution.getVariable('VNFAResponse_MESSAGE') + + try { + logger.debug(getProcessKey(execution) + ": received callback:\n" + callback) + + // The XML callback is available to the calling flow in any case, + // even if a WorkflowException is generated. + execution.setVariable(getProcessKey(execution) + 'Response', callback) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. + execution.setVariable("WorkflowResponse", callback) + + callback = utils.removeXmlPreamble(callback) + + Node root = new XmlParser().parseText(callback) + if (root.name().endsWith('Exception')) { + vnfAdapterWorkflowException(execution, callback) + } + } catch (Exception e) { + logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO) - } - } - - /** - * Tries to parse the response as XML to extract the information to create - * a WorkflowException. If the response cannot be parsed, a more generic - * WorkflowException is created. - */ - public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { - try { - Node root = new XmlParser().parseText(response) - String category = getChildText(root, "category") - category = category == null || category.isEmpty() ? "" : " category='" + category + "'" - String message = getChildText(root, "message") - message = message == null || message.isEmpty() ? "" : " message='" + message + "'" - String rolledBack = getChildText(root, "rolledBack") - rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" - exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + + } + } + + /** + * Tries to parse the response as XML to extract the information to create + * a WorkflowException. If the response cannot be parsed, a more generic + * WorkflowException is created. + */ + public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { + try { + Node root = new XmlParser().parseText(response) + String category = getChildText(root, "category") + category = category == null || category.isEmpty() ? "" : " category='" + category + "'" + String message = getChildText(root, "message") + message = message == null || message.isEmpty() ? "" : " message='" + message + "'" + String rolledBack = getChildText(root, "rolledBack") + rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" + exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK); - } catch (Exception e) { - response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response + } catch (Exception e) { + response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK) - } - } - - /** - * Gets the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node, or null if no such child exists - */ - private Node getChild(Node node, String name) { - for (Node child : node.children()) { - if (child.name() == name) { - return child - } - } - return null - } - - /** - * Gets the text of the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node text, or null if no such child exists - */ - private String getChildText(Node node, String name) { - Node child = getChild(node, name) - return child == null ? null : child.text() - } - - public Logger getLogger() { - return logger; - } + } + } + + /** + * Gets the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node, or null if no such child exists + */ + private Node getChild(Node node, String name) { + for (Node child : node.children()) { + if (child.name() == name) { + return child + } + } + return null + } + + /** + * Gets the text of the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node text, or null if no such child exists + */ + private String getChildText(Node node, String name) { + Node child = getChild(node, name) + return child == null ? null : child.text() + } + + public Logger getLogger() { + return logger; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java index bc330eeafd..b554d7a9ba 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java @@ -35,6 +35,8 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria private String serviceType; @JsonProperty("service-role") private String serviceRole; + @JsonProperty("service-function") + private String serviceFunction; @JsonProperty("environment-context") private String environmentContext; @JsonProperty("workload-context") @@ -77,6 +79,14 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria this.serviceRole = serviceRole; } + public String getServiceFunction() { + return serviceFunction; + } + + public void setServiceFunction(String serviceFunction) { + this.serviceFunction = serviceFunction; + } + public String getEnvironmentContext() { return environmentContext; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 2e9d4b0117..30fd2c8770 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -45,6 +45,7 @@ import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; +import org.onap.so.utils.Components; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -207,26 +208,26 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + + buildWorkflowException(execution, errorCode, errorMessage); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { String processKey = getProcessKey(execution); - logger.info("Building a WorkflowException for Subflow"); + logger.info("Building a WorkflowException"); WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); - throw new BpmnError("MSOWorkflowException"); } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) { - String processKey = getProcessKey(execution); - logger.info("Building a WorkflowException for Subflow"); - WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource); - execution.setVariable("WorkflowException", exception); - execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - logger.info("Outgoing WorkflowException is {}", exception); + buildWorkflowException(execution, errorCode, errorMessage, extSystemErrorSource); logger.info("Throwing MSOWorkflowException"); throw new BpmnError("MSOWorkflowException"); } @@ -313,7 +314,7 @@ public class ExceptionBuilder { execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); + logger.info("Throwing AAIInventoryFailure"); throw new BpmnError("AAIInventoryFailure"); } @@ -323,9 +324,42 @@ public class ExceptionBuilder { execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); + logger.info("Throwing AAIInventoryFailure"); throw new BpmnError("AAIInventoryFailure"); } } + public void processVnfAdapterException(DelegateExecution execution) { + StringBuilder workflowExceptionMessage = new StringBuilder(); + logger.debug("Processing Vnf Adapter Exception"); + try { + String errorMessage = (String) execution.getVariable("openstackAdapterErrorMessage"); + boolean openstackRollbackPollSuccess = (boolean) execution.getVariable("OpenstackPollSuccess"); + boolean rollbackPerformed = (boolean) execution.getVariable("rollbackPerformed"); + boolean openstackRollbackSuccess = (boolean) execution.getVariable("OpenstackRollbackSuccess"); + boolean pollRollbackStatus = (boolean) execution.getVariable("PollRollbackStatus"); + + workflowExceptionMessage.append("Exception occured during vnf adapter: " + errorMessage + "."); + + boolean rollbackCompleted = false; + if (rollbackPerformed) { + if (openstackRollbackSuccess && !pollRollbackStatus) { + rollbackCompleted = true; + } else if (openstackRollbackSuccess && pollRollbackStatus) { + if (openstackRollbackPollSuccess) { + rollbackCompleted = true; + } + } + workflowExceptionMessage + .append(" The resource was rollbacked in openstack: " + rollbackCompleted + "."); + } + } catch (Exception e) { + logger.debug("Error while Processing Vnf Adapter Exception", e); + } + buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK); + throw new BpmnError("MSOWorkflowException"); + + + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn new file mode 100644 index 0000000000..69b68e534e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn @@ -0,0 +1,336 @@ +<?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="_GraPIIyxEeWmdMDkx6Uftw" 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="vnfAdapterTask" name="vnfAdapterTask" isExecutable="true"> + <bpmn2:endEvent id="EndEvent_6"> + <bpmn2:incoming>SequenceFlow_13uy51h</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="executeOpenstackAction" /> + <bpmn2:serviceTask id="executeOpenstackAction" name=" Openstack Action (resource) " camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterInvoke"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1ff2y8j</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1ff2y8j" sourceRef="executeOpenstackAction" targetRef="ExclusiveGateway_08a6you" /> + <bpmn2:serviceTask id="ServiceTask_11iuzx9" name=" Openstack Query (resource) " camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling"> + <bpmn2:incoming>SequenceFlow_1p39f4r</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ecut35</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_0ecut35" sourceRef="ServiceTask_11iuzx9" targetRef="ExclusiveGateway_1fn953y" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1fn953y" name="Success?"> + <bpmn2:incoming>SequenceFlow_0ecut35</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_13uy51h</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0o8wnkx</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_13uy51h" name="Yes" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_6"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == true }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_0o8wnkx" name="No" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_1dt01ez"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == false }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="ExclusiveGateway_08a6you" name="Success?"> + <bpmn2:incoming>SequenceFlow_1ff2y8j</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1p39f4r</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_007m32h</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_1p39f4r" name="Yes" sourceRef="ExclusiveGateway_08a6you" targetRef="ServiceTask_11iuzx9"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == true }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_007m32h" name="No" sourceRef="ExclusiveGateway_08a6you" targetRef="EndEvent_0rxprkw"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == false }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:subProcess id="SubProcess_0y17e8j" name="Error Handling" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_17oglfe"> + <bpmn2:outgoing>SequenceFlow_02rhau9</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_040yoan"> + <bpmn2:incoming>SequenceFlow_0y1by9x</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_006myq9</bpmn2:outgoing> + <bpmn2:compensateEventDefinition waitForCompletion="true" activityRef="executeOpenstackAction" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0qlnby0" name="Poll Rollback Status?" default="SequenceFlow_1piwh1c"> + <bpmn2:incoming>SequenceFlow_006myq9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1ubla93</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1piwh1c</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_02rhau9" sourceRef="StartEvent_17oglfe" targetRef="ExclusiveGateway_18ndby1" /> + <bpmn2:sequenceFlow id="SequenceFlow_006myq9" sourceRef="IntermediateThrowEvent_040yoan" targetRef="ExclusiveGateway_0qlnby0" /> + <bpmn2:serviceTask id="ServiceTask_120p27h" name=" Openstack Query (resource) " camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling"> + <bpmn2:incoming>SequenceFlow_1ubla93</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1nku4uk</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0tuxj9l"> + <bpmn2:incoming>SequenceFlow_1piwh1c</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1nku4uk</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1yx80cq</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:serviceTask id="buildError" name=" Process Exception " camunda:expression="${ExceptionBuilder.processVnfAdapterException(execution)}"> + <bpmn2:incoming>SequenceFlow_1yx80cq</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1az3a2q</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0bnzfqb</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1ubla93" name="Yes" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ServiceTask_120p27h"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PollRollbackStatus") == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1piwh1c" name="No" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ExclusiveGateway_0tuxj9l" /> + <bpmn2:sequenceFlow id="SequenceFlow_1nku4uk" sourceRef="ServiceTask_120p27h" targetRef="ExclusiveGateway_0tuxj9l" /> + <bpmn2:sequenceFlow id="SequenceFlow_1yx80cq" sourceRef="ExclusiveGateway_0tuxj9l" targetRef="buildError" /> + <bpmn2:sequenceFlow id="SequenceFlow_0bnzfqb" sourceRef="buildError" targetRef="EndEvent_1yiy2fi" /> + <bpmn2:endEvent id="EndEvent_1yiy2fi"> + <bpmn2:incoming>SequenceFlow_0bnzfqb</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_18ndby1" name="Rollback Resource?" default="SequenceFlow_1az3a2q"> + <bpmn2:incoming>SequenceFlow_02rhau9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0y1by9x</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1az3a2q</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0y1by9x" name="Yes" sourceRef="ExclusiveGateway_18ndby1" targetRef="IntermediateThrowEvent_040yoan"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("backout") == true }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1az3a2q" name="No" sourceRef="ExclusiveGateway_18ndby1" targetRef="buildError" /> + </bpmn2:subProcess> + <bpmn2:boundaryEvent id="BoundaryEvent_1ysr7mk" attachedToRef="executeOpenstackAction"> + <bpmn2:compensateEventDefinition /> + </bpmn2:boundaryEvent> + <bpmn2:serviceTask id="Task_0zbd85n" name=" Openstack Rollback (resource) " isForCompensation="true" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterRollback" /> + <bpmn2:endEvent id="EndEvent_0rxprkw"> + <bpmn2:incoming>SequenceFlow_007m32h</bpmn2:incoming> + <bpmn2:errorEventDefinition errorRef="Error_1" /> + </bpmn2:endEvent> + <bpmn2:endEvent id="EndEvent_1dt01ez"> + <bpmn2:incoming>SequenceFlow_0o8wnkx</bpmn2:incoming> + <bpmn2:errorEventDefinition errorRef="Error_1" /> + </bpmn2:endEvent> + <bpmn2:association id="Association_1cnlu6p" associationDirection="One" sourceRef="BoundaryEvent_1ysr7mk" targetRef="Task_0zbd85n" /> + </bpmn2:process> + <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:message id="Message_1" name="WorkflowMessage" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterTask"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1"> + <dc:Bounds x="110" y="146" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="116" y="187" width="24" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="ServiceTask_0rcy900_di"> + <di:waypoint xsi:type="dc:Point" x="146" y="164" /> + <di:waypoint xsi:type="dc:Point" x="253" y="163" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="154.5" y="145.5" width="90" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6"> + <dc:Bounds x="929" y="146" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="924" y="187" width="46" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0rcy900_di" bpmnElement="executeOpenstackAction"> + <dc:Bounds x="253" y="124" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ff2y8j_di" bpmnElement="SequenceFlow_1ff2y8j"> + <di:waypoint xsi:type="dc:Point" x="353" y="164" /> + <di:waypoint xsi:type="dc:Point" x="404" y="164" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="333.5" y="139" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_11iuzx9_di" bpmnElement="ServiceTask_11iuzx9"> + <dc:Bounds x="541" y="124" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ecut35_di" bpmnElement="SequenceFlow_0ecut35"> + <di:waypoint xsi:type="dc:Point" x="641" y="164" /> + <di:waypoint xsi:type="dc:Point" x="676" y="164" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="613.5" y="139" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1fn953y_di" bpmnElement="ExclusiveGateway_1fn953y" isMarkerVisible="true"> + <dc:Bounds x="676" y="139" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="676" y="119" width="49" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13uy51h_di" bpmnElement="SequenceFlow_13uy51h"> + <di:waypoint xsi:type="dc:Point" x="726" y="164" /> + <di:waypoint xsi:type="dc:Point" x="929" y="164" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="746.6875" y="166" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0o8wnkx_di" bpmnElement="SequenceFlow_0o8wnkx"> + <di:waypoint xsi:type="dc:Point" x="701" y="189" /> + <di:waypoint xsi:type="dc:Point" x="701" y="249" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="706" y="198" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_120p27h_di" bpmnElement="ServiceTask_120p27h"> + <dc:Bounds x="496" y="443" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_08a6you_di" bpmnElement="ExclusiveGateway_08a6you" isMarkerVisible="true"> + <dc:Bounds x="404" y="139" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="409" y="117" width="49" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1p39f4r_di" bpmnElement="SequenceFlow_1p39f4r"> + <di:waypoint xsi:type="dc:Point" x="454" y="164" /> + <di:waypoint xsi:type="dc:Point" x="541" y="164" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="472" y="168" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_007m32h_di" bpmnElement="SequenceFlow_007m32h"> + <di:waypoint xsi:type="dc:Point" x="429" y="189" /> + <di:waypoint xsi:type="dc:Point" x="429" y="249" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="435" y="198" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_09bkjg0_di" bpmnElement="SubProcess_0y17e8j" isExpanded="true"> + <dc:Bounds x="151" y="404" width="787" height="344" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BoundaryEvent_04c5efr_di" bpmnElement="BoundaryEvent_1ysr7mk"> + <dc:Bounds x="335" y="186" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="353" y="226" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_1cnlu6p_di" bpmnElement="Association_1cnlu6p"> + <di:waypoint xsi:type="dc:Point" x="353" y="222" /> + <di:waypoint xsi:type="dc:Point" x="353" y="267" /> + <di:waypoint xsi:type="dc:Point" x="321" y="267" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0vacscp_di" bpmnElement="Task_0zbd85n"> + <dc:Bounds x="221" y="227" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0lzcn0v_di" bpmnElement="EndEvent_0rxprkw"> + <dc:Bounds x="411" y="249" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="429" y="288.658" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_14424k5_di" bpmnElement="EndEvent_1dt01ez"> + <dc:Bounds x="683" y="249" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="701" y="288.658" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1wrpebh_di" bpmnElement="StartEvent_17oglfe"> + <dc:Bounds x="181" y="599" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="198.35199999999998" y="638.658" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0gltuh4_di" bpmnElement="IntermediateThrowEvent_040yoan"> + <dc:Bounds x="365" y="529" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="382.352" y="569" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0qlnby0_di" bpmnElement="ExclusiveGateway_0qlnby0" isMarkerVisible="true"> + <dc:Bounds x="429.352" y="522" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="484" y="535" width="62" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_02rhau9_di" bpmnElement="SequenceFlow_02rhau9"> + <di:waypoint xsi:type="dc:Point" x="217" y="617" /> + <di:waypoint xsi:type="dc:Point" x="284" y="617" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="250.5" y="596" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_006myq9_di" bpmnElement="SequenceFlow_006myq9"> + <di:waypoint xsi:type="dc:Point" x="401" y="547" /> + <di:waypoint xsi:type="dc:Point" x="429" y="547" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="526" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0tuxj9l_di" bpmnElement="ExclusiveGateway_0tuxj9l" isMarkerVisible="true"> + <dc:Bounds x="608.352" y="522" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633.352" y="576" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_108cgfw_di" bpmnElement="buildError"> + <dc:Bounds x="695" y="577" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ubla93_di" bpmnElement="SequenceFlow_1ubla93"> + <di:waypoint xsi:type="dc:Point" x="454" y="522" /> + <di:waypoint xsi:type="dc:Point" x="454" y="483" /> + <di:waypoint xsi:type="dc:Point" x="496" y="483" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="461" y="489" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1piwh1c_di" bpmnElement="SequenceFlow_1piwh1c"> + <di:waypoint xsi:type="dc:Point" x="454" y="572" /> + <di:waypoint xsi:type="dc:Point" x="454" y="603" /> + <di:waypoint xsi:type="dc:Point" x="633" y="603" /> + <di:waypoint xsi:type="dc:Point" x="633" y="572" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="460" y="576.85" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1nku4uk_di" bpmnElement="SequenceFlow_1nku4uk"> + <di:waypoint xsi:type="dc:Point" x="596" y="483" /> + <di:waypoint xsi:type="dc:Point" x="633" y="483" /> + <di:waypoint xsi:type="dc:Point" x="633" y="522" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="614.5" y="462" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yx80cq_di" bpmnElement="SequenceFlow_1yx80cq"> + <di:waypoint xsi:type="dc:Point" x="658" y="547" /> + <di:waypoint xsi:type="dc:Point" x="745" y="547" /> + <di:waypoint xsi:type="dc:Point" x="745" y="577" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="656.5" y="526" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0bnzfqb_di" bpmnElement="SequenceFlow_0bnzfqb"> + <di:waypoint xsi:type="dc:Point" x="795" y="617" /> + <di:waypoint xsi:type="dc:Point" x="870" y="617" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="787.5" y="596" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1l1f6zj_di" bpmnElement="EndEvent_1yiy2fi"> + <dc:Bounds x="870" y="599" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="887.352" y="639" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_18ndby1_di" bpmnElement="ExclusiveGateway_18ndby1" isMarkerVisible="true"> + <dc:Bounds x="284.352" y="592" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="338" y="605" width="54" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0y1by9x_di" bpmnElement="SequenceFlow_0y1by9x"> + <di:waypoint xsi:type="dc:Point" x="309" y="592" /> + <di:waypoint xsi:type="dc:Point" x="309" y="547" /> + <di:waypoint xsi:type="dc:Point" x="365" y="547" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="315" y="558" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1az3a2q_di" bpmnElement="SequenceFlow_1az3a2q"> + <di:waypoint xsi:type="dc:Point" x="309" y="642" /> + <di:waypoint xsi:type="dc:Point" x="309" y="686" /> + <di:waypoint xsi:type="dc:Point" x="745" y="686" /> + <di:waypoint xsi:type="dc:Point" x="745" y="657" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="318" y="657" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index 506088eb15..477dce1072 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -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. diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn new file mode 100644 index 0000000000..d77b1cebb1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn @@ -0,0 +1,67 @@ +<?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.9.0"> + <bpmn:process id="VNFConfigModifyActivity" name="VNFConfigModifyActivity" isExecutable="true"> + <bpmn:startEvent id="Start_VNFConfigModifyActivity" name="Start"> + <bpmn:outgoing>SequenceFlow_0d87xrn</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="ConfigModify" name="VNF Config Modify " camunda:type="external" camunda:topic="AppcService"> + <bpmn:incoming>SequenceFlow_05oatn2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pg83wr</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0d87xrn" sourceRef="Start_VNFConfigModifyActivity" targetRef="PreProcessActivity" /> + <bpmn:endEvent id="End_VNFConfigModifyActivity" name="End"> + <bpmn:incoming>SequenceFlow_1pg83wr</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1pg83wr" sourceRef="ConfigModify" targetRef="End_VNFConfigModifyActivity" /> + <bpmn:serviceTask id="PreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcOrchestratorPreProcessor.buildAppcTaskRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),"ConfigModify")}"> + <bpmn:incoming>SequenceFlow_0d87xrn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05oatn2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_05oatn2" sourceRef="PreProcessActivity" targetRef="ConfigModify" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFConfigModifyActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_VNFConfigModifyActivity"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="138" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1q3bjtz_di" bpmnElement="ConfigModify"> + <dc:Bounds x="532" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0d87xrn_di" bpmnElement="SequenceFlow_0d87xrn"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="257" y="120" /> + <di:waypoint xsi:type="dc:Point" x="257" y="120" /> + <di:waypoint xsi:type="dc:Point" x="304" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="114" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_15t8iwk_di" bpmnElement="End_VNFConfigModifyActivity"> + <dc:Bounds x="756" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="764" y="142" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1pg83wr_di" bpmnElement="SequenceFlow_1pg83wr"> + <di:waypoint xsi:type="dc:Point" x="632" y="120" /> + <di:waypoint xsi:type="dc:Point" x="756" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="694" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0h60lbz_di" bpmnElement="PreProcessActivity"> + <dc:Bounds x="308" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05oatn2_di" bpmnElement="SequenceFlow_05oatn2"> + <di:waypoint xsi:type="dc:Point" x="408" y="120" /> + <di:waypoint xsi:type="dc:Point" x="532" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="470" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn index 30a95eb81f..e139e94660 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn @@ -27,92 +27,91 @@ <bpmn:outgoing>SequenceFlow_1ivhukd</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1ivhukd" sourceRef="PostProcessResponse" targetRef="VnfAdapter_End" /> - <bpmn:callActivity id="Call_vnfAdapterRestV1" name="Call vnfAdapterRestV1" calledElement="vnfAdapterRestV1"> + <bpmn:callActivity id="Call_vnfAdapterTask" name=" Cloud Create (vnf) " calledElement="vnfAdapterTask"> <bpmn:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="VNFREST_Request" target="vnfAdapterRestV1Request" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="vnfAdapterRestV1Response" target="vnfAdapterRestV1Response" /> + <camunda:in source="VNFREST_Request" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="WorkflowResponse" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0qaaf5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0j1zvis</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterRestV1" /> - <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterRestV1" targetRef="PostProcessResponse" /> + <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterTask" /> + <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterTask" targetRef="PostProcessResponse" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VnfAdapter"> <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="VnfAdapter_Start"> - <dc:Bounds x="213" y="357" width="36" height="36" /> + <dc:Bounds x="156" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="219" y="393" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_17szae7_di" bpmnElement="VnfAdapter_Error" isExpanded="true"> - <dc:Bounds x="453" y="529" width="233" height="135" /> + <dc:Bounds x="396" y="275" width="233" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint xsi:type="dc:Point" x="249" y="375" /> - <di:waypoint xsi:type="dc:Point" x="329" y="375" /> + <di:waypoint xsi:type="dc:Point" x="192" y="121" /> + <di:waypoint xsi:type="dc:Point" x="272" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="244" y="360" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_16vfqpk_di" bpmnElement="Error_End"> - <dc:Bounds x="606" y="573" width="36" height="36" /> + <dc:Bounds x="549" y="319" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="615" y="613" width="19" height="12" /> + <dc:Bounds x="558" y="359" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1t3ep1m_di" bpmnElement="Error_Start"> - <dc:Bounds x="491" y="573" width="36" height="36" /> + <dc:Bounds x="434" y="319" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="498" y="613" width="24" height="12" /> + <dc:Bounds x="441" y="359" width="24" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1abat8l_di" bpmnElement="SequenceFlow_1abat8l"> - <di:waypoint xsi:type="dc:Point" x="527" y="591" /> - <di:waypoint xsi:type="dc:Point" x="566" y="591" /> - <di:waypoint xsi:type="dc:Point" x="566" y="591" /> - <di:waypoint xsi:type="dc:Point" x="606" y="591" /> + <di:waypoint xsi:type="dc:Point" x="470" y="337" /> + <di:waypoint xsi:type="dc:Point" x="509" y="337" /> + <di:waypoint xsi:type="dc:Point" x="509" y="337" /> + <di:waypoint xsi:type="dc:Point" x="549" y="337" /> <bpmndi:BPMNLabel> <dc:Bounds x="536" y="591" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="VnfAdapter_End"> - <dc:Bounds x="894" y="357" width="36" height="36" /> + <dc:Bounds x="837" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="902" y="397" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="PreProcessRequest"> - <dc:Bounds x="329" y="335" width="100" height="80" /> + <dc:Bounds x="272" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1yomr79_di" bpmnElement="PostProcessResponse"> - <dc:Bounds x="714" y="335" width="100" height="80" /> + <dc:Bounds x="657" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ivhukd_di" bpmnElement="SequenceFlow_1ivhukd"> - <di:waypoint xsi:type="dc:Point" x="814" y="375" /> - <di:waypoint xsi:type="dc:Point" x="894" y="375" /> + <di:waypoint xsi:type="dc:Point" x="757" y="121" /> + <di:waypoint xsi:type="dc:Point" x="837" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="809" y="354" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterRestV1"> - <dc:Bounds x="520" y="335" width="100" height="80" /> + <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterTask"> + <dc:Bounds x="463" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0qaaf5k_di" bpmnElement="SequenceFlow_0qaaf5k"> - <di:waypoint xsi:type="dc:Point" x="429" y="375" /> - <di:waypoint xsi:type="dc:Point" x="520" y="375" /> + <di:waypoint xsi:type="dc:Point" x="372" y="121" /> + <di:waypoint xsi:type="dc:Point" x="463" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="429.5" y="354" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0j1zvis_di" bpmnElement="SequenceFlow_0j1zvis"> - <di:waypoint xsi:type="dc:Point" x="620" y="375" /> - <di:waypoint xsi:type="dc:Point" x="714" y="375" /> + <di:waypoint xsi:type="dc:Point" x="563" y="121" /> + <di:waypoint xsi:type="dc:Point" x="657" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="622" y="354" width="90" height="12" /> </bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java new file mode 100644 index 0000000000..99ee8d9fcb --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doThrow; +import java.util.List; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.externaltask.LockedExternalTask; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFConfigModifyActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFConfigModifyActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables); + assertThat(pi).isNotNull(); + processExternalTasks(pi, "ConfigModify"); + assertThat(pi).isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity", + "ConfigModify", "End_VNFConfigModifyActivity"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFConfigModifyActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcOrchestratorPreProcessor) + .buildAppcTaskRequest(any(BuildingBlockExecution.class), any(String.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity") + .hasNotPassed("ConfigModify", "End_VNFConfigModifyActivity"); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java index 8ad4e0f07f..4dbf4d46ff 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,11 +32,11 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class VnfAdapterTest extends BaseBPMNTest { @Test public void vnfAdapterCreatedTest() { - mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub"); + mockSubprocess("vnfAdapterTask", "Mocked vnfAdapterTask", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1", + assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterTask", "PostProcessResponse", "VnfAdapter_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 8b9726c2b7..7d1bc4c779 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -127,11 +127,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String key = iterator.next() HashMap<String, String> hashMap = new HashMap() hashMap.put("name", key) - if(jsonObject.get(key)==null){ - hashMap.put("value", "") - }else{ - hashMap.put("value", jsonObject.get(key)) - } + hashMap.put("value", jsonObject.get(key)) paramList.add(hashMap) } Map<String, List<Map<String, Object>>> paramMap = new HashMap() @@ -260,6 +256,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { break + case ~/[\w\s\W]*UNI[\w\s\W]*/ : + def resourceInput = resourceInputObj.getResourceParameters() + String incomingRequest = resourceInputObj.getRequestsInputs() + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(requestInputs) + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name")) + resourceInputObj.setResourceParameters(uResourceInput) + execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) + break + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*SOTN-Attachment[\w\s\W]*/ : @@ -363,7 +370,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id> <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <service-type>${msoUtils.xmlEscape(serviceType)}</service-type> <notification-url>sdncCallback</notification-url> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 61b1250522..cdc242dbd8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -221,6 +221,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { switch (modelType) { case "VNF": + if(modelName.contains("UNI") && "MDONS_OTN".equals(serviceType)){ + String serviceInstanceName = resourceInputObj.getResourceInstanceName() + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>optical-service-delete</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id> + <payload> + <param> + <name>service-name</name> + <value>${msoUtils.xmlEscape(serviceInstanceName)}</value> + </param> + </payload> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } else{ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -275,6 +299,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } break case "GROUP" : //When a new resource creation request reaches SO, the parent resources information needs to be provided diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index a77f6f0628..a505aa1a34 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -50,164 +50,164 @@ import javax.ws.rs.NotFoundException public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleRollback.class); - def Prefix="DCVFMR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(DelegateExecution execution) { - - - initProcessVariables(execution) - - try { - - execution.setVariable("rolledBack", null) - execution.setVariable("rollbackError", null) - - def rollbackData = execution.getVariable("rollbackData") - logger.debug("RollbackData:" + rollbackData) - - if (rollbackData != null) { - String vnfId = rollbackData.get("VFMODULE", "vnfid") - execution.setVariable("DCVFMR_vnfId", vnfId) - String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") - execution.setVariable("DCVFMR_vfModuleId", vfModuleId) - String source = rollbackData.get("VFMODULE", "source") - execution.setVariable("DCVFMR_source", source) - String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") - execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - String serviceId = rollbackData.get("VFMODULE", "service-id") - execution.setVariable("DCVFMR_serviceId", serviceId) - String vnfType = rollbackData.get("VFMODULE", "vnftype") - execution.setVariable("DCVFMR_vnfType", vnfType) - String vnfName = rollbackData.get("VFMODULE", "vnfname") - execution.setVariable("DCVFMR_vnfName", vnfName) - String tenantId = rollbackData.get("VFMODULE", "tenantid") - execution.setVariable("DCVFMR_tenantId", tenantId) - String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") - execution.setVariable("DCVFMR_vfModuleName", vfModuleName) - String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") - execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) - String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") - execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) - String cloudOwner = rollbackData.get("VFMODULE", "cloudowner") - execution.setVariable("DCVFMR_cloudOwner", cloudOwner) - String heatStackId = rollbackData.get("VFMODULE", "heatstackid") - execution.setVariable("DCVFMR_heatStackId", heatStackId) - String requestId = rollbackData.get("VFMODULE", "msorequestid") - execution.setVariable("DCVFMR_requestId", requestId) - // Set mso-request-id to request-id for VNF Adapter interface - execution.setVariable("mso-request-id", requestId) - List createdNetworkPolicyFqdnList = [] - int i = 0 - while (i < 100) { - String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i) - if (fqdn == null) { - break - } - createdNetworkPolicyFqdnList.add(fqdn) - logger.debug("got fqdn # " + i + ": " + fqdn) - i = i + 1 - - } - - execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList) - String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address") - execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address) - String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address") - execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address) - //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid") - //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) - execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) - execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) - execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) - execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) - execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) - execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI")) - execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI")) - - // formulate the request for PrepareUpdateAAIVfModule - String request = """<PrepareUpdateAAIVfModuleRequest> + def Prefix="DCVFMR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(DelegateExecution execution) { + + + initProcessVariables(execution) + + try { + + execution.setVariable("rolledBack", null) + execution.setVariable("rollbackError", null) + + def rollbackData = execution.getVariable("rollbackData") + logger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + String vnfId = rollbackData.get("VFMODULE", "vnfid") + execution.setVariable("DCVFMR_vnfId", vnfId) + String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") + execution.setVariable("DCVFMR_vfModuleId", vfModuleId) + String source = rollbackData.get("VFMODULE", "source") + execution.setVariable("DCVFMR_source", source) + String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") + execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + String serviceId = rollbackData.get("VFMODULE", "service-id") + execution.setVariable("DCVFMR_serviceId", serviceId) + String vnfType = rollbackData.get("VFMODULE", "vnftype") + execution.setVariable("DCVFMR_vnfType", vnfType) + String vnfName = rollbackData.get("VFMODULE", "vnfname") + execution.setVariable("DCVFMR_vnfName", vnfName) + String tenantId = rollbackData.get("VFMODULE", "tenantid") + execution.setVariable("DCVFMR_tenantId", tenantId) + String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") + execution.setVariable("DCVFMR_vfModuleName", vfModuleName) + String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") + execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) + String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") + execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) + String cloudOwner = rollbackData.get("VFMODULE", "cloudowner") + execution.setVariable("DCVFMR_cloudOwner", cloudOwner) + String heatStackId = rollbackData.get("VFMODULE", "heatstackid") + execution.setVariable("DCVFMR_heatStackId", heatStackId) + String requestId = rollbackData.get("VFMODULE", "msorequestid") + execution.setVariable("DCVFMR_requestId", requestId) + // Set mso-request-id to request-id for VNF Adapter interface + execution.setVariable("mso-request-id", requestId) + List createdNetworkPolicyFqdnList = [] + int i = 0 + while (i < 100) { + String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i) + if (fqdn == null) { + break + } + createdNetworkPolicyFqdnList.add(fqdn) + logger.debug("got fqdn # " + i + ": " + fqdn) + i = i + 1 + + } + + execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList) + String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address") + execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address) + String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address") + execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address) + //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid") + //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) + execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) + execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) + execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) + execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI")) + execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI")) + + // formulate the request for PrepareUpdateAAIVfModule + String request = """<PrepareUpdateAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <orchestration-status>pending-delete</orchestration-status> </PrepareUpdateAAIVfModuleRequest>""" as String - logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - } else { - execution.setVariable("skipRollback", true) - } - - if (execution.getVariable("disableRollback").equals("true" )) { - execution.setVariable("skipRollback", true) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage() - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(DelegateExecution execution) { - - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() - } - - def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) - - String source = execution.getVariable("DCVFMR_source") - String serviceId = execution.getVariable("DCVFMR_serviceId") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vnfType = execution.getVariable("DCVFMR_vnfType") - String vnfName = execution.getVariable("DCVFMR_vnfName") - String tenantId = execution.getVariable("DCVFMR_tenantId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") - String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") - String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") - String requestId = execution.getVariable("DCVFMR_requestId") - - String serviceInstanceIdToSdnc = "" - if (srvInstId != null && !srvInstId.isEmpty()) { - serviceInstanceIdToSdnc = srvInstId - } else { - serviceInstanceIdToSdnc = vfModuleId - } - - def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") - def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") - - def action = "" - def requestAction = "" - - if (doSDNCActivateRollback.equals("true")) { - action = "delete" - requestAction = "DisconnectVNFRequest" - } - else if (doSDNCAssignRollback.equals("true")) { - action = "rollback" - requestAction = "VNFActivateRequest" - } - else - return - - - String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + } else { + execution.setVariable("skipRollback", true) + } + + if (execution.getVariable("disableRollback").equals("true" )) { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(DelegateExecution execution) { + + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() + } + + def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + + String source = execution.getVariable("DCVFMR_source") + String serviceId = execution.getVariable("DCVFMR_serviceId") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vnfType = execution.getVariable("DCVFMR_vnfType") + String vnfName = execution.getVariable("DCVFMR_vnfName") + String tenantId = execution.getVariable("DCVFMR_tenantId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") + String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") + String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") + String requestId = execution.getVariable("DCVFMR_requestId") + + String serviceInstanceIdToSdnc = "" + if (srvInstId != null && !srvInstId.isEmpty()) { + serviceInstanceIdToSdnc = srvInstId + } else { + serviceInstanceIdToSdnc = vfModuleId + } + + def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") + def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") + + def action = "" + def requestAction = "" + + if (doSDNCActivateRollback.equals("true")) { + action = "delete" + requestAction = "DisconnectVNFRequest" + } + else if (doSDNCAssignRollback.equals("true")) { + action = "rollback" + requestAction = "VNFActivateRequest" + } + else + return + + + String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> @@ -245,76 +245,76 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - logger.debug("sdncAdapterWorkflowRequest: " + request) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - - execution.setVariable("prefix", Prefix) - logger.trace("STARTED preProcessSDNCDeactivateRequest") - - def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest) - logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED preProcessSDNCDeactivateRequest") - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logger.trace('Entered ' + method) - execution.setVariable("prefix", Prefix) - logger.trace("STARTED preProcessSDNCUnassignRequest Process") - try{ - String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest) - logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - }catch(Exception e){ - logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED preProcessSDNCUnassignRequest Process") - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() - } - def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) - def requestId = execution.getVariable("DCVFMR_requestId") - def serviceId = execution.getVariable("DCVFMR_serviceId") - def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - def vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - def source = execution.getVariable("DCVFMR_source") - def vnfId = execution.getVariable("DCVFMR_vnfId") - - def sdncVersion = execution.getVariable("sdncVersion") - - String sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + logger.debug("sdncAdapterWorkflowRequest: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + logger.trace("STARTED preProcessSDNCDeactivateRequest") + + def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED preProcessSDNCDeactivateRequest") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + logger.trace("STARTED preProcessSDNCUnassignRequest Process") + try{ + String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + }catch(Exception e){ + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() + } + def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + def requestId = execution.getVariable("DCVFMR_requestId") + def serviceId = execution.getVariable("DCVFMR_serviceId") + def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + def vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + def source = execution.getVariable("DCVFMR_source") + def vnfId = execution.getVariable("DCVFMR_vnfId") + + def sdncVersion = execution.getVariable("sdncVersion") + + String sdncRequest = + """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> @@ -351,32 +351,32 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - logger.debug("sdncRequest: " + sdncRequest) - return sdncRequest - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - - String requestId = UUID.randomUUID().toString() - String origRequestId = execution.getVariable("DCVFMR_requestId") - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") - String cloudOwner = execution.getVariable("DCVFMR_cloudOwner") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") - String tenantId = execution.getVariable("DCVFMR_tenantId") - def messageId = execution.getVariable('mso-request-id') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ + logger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + String requestId = UUID.randomUUID().toString() + String origRequestId = execution.getVariable("DCVFMR_requestId") + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") + String cloudOwner = execution.getVariable("DCVFMR_cloudOwner") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") + String tenantId = execution.getVariable("DCVFMR_tenantId") + def messageId = execution.getVariable('mso-request-id') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> @@ -394,117 +394,116 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </deleteVfModuleRequest> """ as String - logger.debug("vnfAdapterRestV1Request: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } + execution.setVariable("vnfAdapterTaskRequest", request) + } - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(DelegateExecution execution) { + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(DelegateExecution execution) { - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<UpdateAAIVfModuleRequest> + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<UpdateAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <heat-stack-id>DELETE</heat-stack-id> <orchestration-status>deleted</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - logger.debug("UpdateAAIVfModuleRequest :" + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) { - - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<UpdateAAIVfModuleRequest> + logger.debug("UpdateAAIVfModuleRequest :" + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) { + + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<UpdateAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <heat-stack-id></heat-stack-id> <orchestration-status>Assigned</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - logger.debug("UpdateAAIVfModuleRequest :" + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { - - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<DeleteAAIVfModuleRequest> + logger.debug("UpdateAAIVfModuleRequest :" + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { + + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<DeleteAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - logger.debug("DeleteAAIVfModuleRequest :" + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } + logger.debug("DeleteAAIVfModuleRequest :" + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), - "BPMN", ErrorCode.UnknownError.getValue()); - String processKey = getProcessKey(execution); - exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), + "BPMN", ErrorCode.UnknownError.getValue()); + String processKey = getProcessKey(execution); + exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") - } + } - public void sdncValidateResponse(DelegateExecution execution, String response){ + public void sdncValidateResponse(DelegateExecution execution, String response){ - execution.setVariable("prefix",Prefix) + execution.setVariable("prefix",Prefix) - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logger.debug("Successfully Validated SDNC Response") - }else{ - throw new BpmnError("MSOWorkflowException") - } - } + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + logger.debug("Successfully Validated SDNC Response") + }else{ + throw new BpmnError("MSOWorkflowException") + } + } - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logger.trace('Entered ' + method) - execution.setVariable("prefix", Prefix) - logger.trace("STARTED deleteNetworkPoliciesFromAAI") + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + logger.trace("STARTED deleteNetworkPoliciesFromAAI") - try { - // get variables - List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") - if (fqdnList == null) { - logger.debug("No network policies to delete") - return - } - int fqdnCount = fqdnList.size() + try { + // get variables + List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") + if (fqdnList == null) { + logger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() - execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) - logger.debug("networkPolicyFqdnCount - " + fqdnCount) + execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) + logger.debug("networkPolicyFqdnCount - " + fqdnCount) - AaiUtil aaiUriUtil = new AaiUtil(this) + AaiUtil aaiUriUtil = new AaiUtil(this) - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { - int counting = i+1 - String fqdn = fqdnList[i] + int counting = i+1 + String fqdn = fqdnList[i] try { // Query AAI for this network policy FQDN @@ -517,10 +516,10 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0) try{ - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) - getAAIClient().delete(delUri) - execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200) - logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + getAAIClient().delete(delUri) + execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200) + logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) logger.debug("The return code from deleting network policy is: " + 200) // This network policy was deleted from AAI successfully logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") @@ -548,113 +547,113 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - } // end loop + } // end loop - } else { - logger.debug("No contrail network policies to query/create") + } else { + logger.debug("No contrail network policies to query/create") - } + } - } catch (BpmnError e) { - throw e; + } catch (BpmnError e) { + throw e; - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } - } + } - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logger.trace('Entered ' + method) + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logger.trace('Entered ' + method) - try { - def vnfId = execution.getVariable('DCVFMR_vnfId') - def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') - def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' + try { + def vnfId = execution.getVariable('DCVFMR_vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' - if (oamManagementV4Address != null) { - ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>' - } + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>' + } - if (oamManagementV6Address != null) { - managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>' - } + if (oamManagementV6Address != null) { + managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>' + } - String updateAAIGenericVnfRequest = """ + String updateAAIGenericVnfRequest = """ <UpdateAAIGenericVnfRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> ${ipv4OamAddressElement} ${managementV6AddressElement} </UpdateAAIGenericVnfRequest> """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - - - 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, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) - } - } - - public void setSuccessfulRollbackStatus (DelegateExecution execution){ - - execution.setVariable("prefix", Prefix) - logger.trace("STARTED setSuccessfulRollbackStatus") - - try{ - // Set rolledBack to true, rollbackError to null - execution.setVariable("rolledBack", true) - execution.setVariable("rollbackError", null) - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED setSuccessfulRollbackStatus") - } - - public void setFailedRollbackStatus (DelegateExecution execution){ - - execution.setVariable("prefix", Prefix) - logger.trace("STARTED setFailedRollbackStatus") - - try{ - // Set rolledBack to false, rollbackError to actual value, rollbackData to null - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback') - execution.setVariable("rollbackData", null) - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing setFailedRollbackStatus.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED setFailedRollbackStatus") - } + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + 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, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) + } + } + + public void setSuccessfulRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + logger.trace("STARTED setSuccessfulRollbackStatus") + + try{ + // Set rolledBack to true, rollbackError to null + execution.setVariable("rolledBack", true) + execution.setVariable("rollbackError", null) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED setSuccessfulRollbackStatus") + } + + public void setFailedRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + logger.trace("STARTED setFailedRollbackStatus") + + try{ + // Set rolledBack to false, rollbackError to actual value, rollbackData to null + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback') + execution.setVariable("rollbackData", null) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing setFailedRollbackStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED setFailedRollbackStatus") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index a24bc4411e..35af3d34d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -450,6 +450,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo()) List<Resource> deleteResourceList = serviceDecomposition.getServiceResources() + if (serviceDecomposition.getServiceType().equals("MDONS_OTN")){ + for (Resource resource : deleteResourceList) { + String serviceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + resource.setResourceId(serviceInstanceId) + resource.setResourceInstanceName(serviceName) + def delMap = new ImmutablePair(resource, null) + deleteRealResourceList.add(delMap) + } + } else{ String serviceRelationShip = execution.getVariable("serviceRelationShip") def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() @@ -492,6 +502,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } } + } // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 002e283790..e776eaf422 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -55,187 +55,185 @@ import org.xml.sax.InputSource /* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input, * functions as a building block subflow - -* Inputs for building block interface: -* @param - requestId -* @param - isDebugLogEnabled -* @param - vnfId -* @param - vfModuleId -* @param - serviceInstanceId -* @param - vfModuleName O -* @param - vfModuleModelInfo -* @param - cloudConfiguration* -* @param - sdncVersion ("1610") -* @param - retainResources -* @param - aLaCarte -* -* Outputs: -* @param - WorkflowException -* -*/ + * Inputs for building block interface: + * @param - requestId + * @param - isDebugLogEnabled + * @param - vnfId + * @param - vfModuleId + * @param - serviceInstanceId + * @param - vfModuleName O + * @param - vfModuleModelInfo + * @param - cloudConfiguration* + * @param - sdncVersion ("1610") + * @param - retainResources + * @param - aLaCarte + * + * Outputs: + * @param - WorkflowException + * + */ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModule.class); - def Prefix="DoDVfMod_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) - execution.setVariable("DoDVfMod_oamManagementV4Address", null) - execution.setVariable("DoDVfMod_oamManagementV6Address", null) - - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(DelegateExecution execution) { - - initProcessVariables(execution) - - try { - def xml = execution.getVariable("DoDeleteVfModuleRequest") - String vnfId = "" - String vfModuleId = "" - - if (xml == null || xml.isEmpty()) { - // Building Block-type request - - // Set mso-request-id to request-id for VNF Adapter interface - String requestId = execution.getVariable("requestId") - execution.setVariable("mso-request-id", requestId) - - String cloudConfiguration = execution.getVariable("cloudConfiguration") - String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable("tenantId", tenantId) - String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable("cloudSiteId", cloudSiteId) - String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner") - execution.setVariable("cloudOwner", cloudOwner) - // Source is HARDCODED - String source = "VID" - execution.setVariable("source", source) - // SrvInstId is hardcoded to empty - execution.setVariable("srvInstId", "") - // ServiceId is hardcoded to empty - execution.setVariable("serviceId", "") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - vnfId = execution.getVariable("vnfId") - vfModuleId = execution.getVariable("vfModuleId") - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) - } - else { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) - } - //vfModuleModelName - def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") - execution.setVariable("vfModuleModelName", vfModuleModelName) - // retainResources - def retainResources = execution.getVariable("retainResources") - if (retainResources == null) { - retainResources = false - } - execution.setVariable("retainResources", retainResources) - } - else { - - logger.debug("DoDeleteVfModule Request: " + xml) - - logger.debug("input request xml: " + xml) - - vnfId = utils.getNodeText(xml,"vnf-id") - execution.setVariable("vnfId", vnfId) - vfModuleId = utils.getNodeText(xml,"vf-module-id") - execution.setVariable("vfModuleId", vfModuleId) - def srvInstId = execution.getVariable("mso-service-instance-id") - execution.setVariable("srvInstId", srvInstId) - String requestId = "" - try { - requestId = execution.getVariable("mso-request-id") - } catch (Exception ex) { - requestId = utils.getNodeText(xml, "request-id") - } - execution.setVariable("requestId", requestId) - String source = utils.getNodeText(xml, "source") - execution.setVariable("source", source) - String serviceId = utils.getNodeText(xml, "service-id") - execution.setVariable("serviceId", serviceId) - String tenantId = utils.getNodeText(xml, "tenant-id") - execution.setVariable("tenantId", tenantId) - - String serviceInstanceIdToSdnc = "" - if (xml.contains("service-instance-id")) { - serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id") - } else { - serviceInstanceIdToSdnc = vfModuleId - } - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc) - String vfModuleName = utils.getNodeText(xml, "vf-module-name") - execution.setVariable("vfModuleName", vfModuleName) - String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name") - execution.setVariable("vfModuleModelName", vfModuleModelName) - String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region") - execution.setVariable("cloudSiteId", cloudSiteId) - String cloudOwner = utils.getNodeText(xml, "cloud-owner") - execution.setVariable("cloudOwner", cloudOwner) - } - - // formulate the request for PrepareUpdateAAIVfModule - String request = """<PrepareUpdateAAIVfModuleRequest> + def Prefix="DoDVfMod_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) + execution.setVariable("DoDVfMod_oamManagementV4Address", null) + execution.setVariable("DoDVfMod_oamManagementV6Address", null) + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(DelegateExecution execution) { + + initProcessVariables(execution) + + try { + def xml = execution.getVariable("DoDeleteVfModuleRequest") + String vnfId = "" + String vfModuleId = "" + + if (xml == null || xml.isEmpty()) { + // Building Block-type request + + // Set mso-request-id to request-id for VNF Adapter interface + String requestId = execution.getVariable("requestId") + execution.setVariable("mso-request-id", requestId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("tenantId", tenantId) + String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("cloudSiteId", cloudSiteId) + String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner") + execution.setVariable("cloudOwner", cloudOwner) + // Source is HARDCODED + String source = "VID" + execution.setVariable("source", source) + // SrvInstId is hardcoded to empty + execution.setVariable("srvInstId", "") + // ServiceId is hardcoded to empty + execution.setVariable("serviceId", "") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + vnfId = execution.getVariable("vnfId") + vfModuleId = execution.getVariable("vfModuleId") + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) + } + else { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) + } + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("vfModuleModelName", vfModuleModelName) + // retainResources + def retainResources = execution.getVariable("retainResources") + if (retainResources == null) { + retainResources = false + } + execution.setVariable("retainResources", retainResources) + } + else { + + logger.debug("DoDeleteVfModule Request: " + xml) + + logger.debug("input request xml: " + xml) + + vnfId = utils.getNodeText(xml,"vnf-id") + execution.setVariable("vnfId", vnfId) + vfModuleId = utils.getNodeText(xml,"vf-module-id") + execution.setVariable("vfModuleId", vfModuleId) + def srvInstId = execution.getVariable("mso-service-instance-id") + execution.setVariable("srvInstId", srvInstId) + String requestId = "" + try { + requestId = execution.getVariable("mso-request-id") + } catch (Exception ex) { + requestId = utils.getNodeText(xml, "request-id") + } + execution.setVariable("requestId", requestId) + String source = utils.getNodeText(xml, "source") + execution.setVariable("source", source) + String serviceId = utils.getNodeText(xml, "service-id") + execution.setVariable("serviceId", serviceId) + String tenantId = utils.getNodeText(xml, "tenant-id") + execution.setVariable("tenantId", tenantId) + + String serviceInstanceIdToSdnc = "" + if (xml.contains("service-instance-id")) { + serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id") + } else { + serviceInstanceIdToSdnc = vfModuleId + } + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc) + String vfModuleName = utils.getNodeText(xml, "vf-module-name") + execution.setVariable("vfModuleName", vfModuleName) + String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name") + execution.setVariable("vfModuleModelName", vfModuleModelName) + String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region") + execution.setVariable("cloudSiteId", cloudSiteId) + String cloudOwner = utils.getNodeText(xml, "cloud-owner") + execution.setVariable("cloudOwner", cloudOwner) + } + + // formulate the request for PrepareUpdateAAIVfModule + String request = """<PrepareUpdateAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <orchestration-status>pending-delete</orchestration-status> </PrepareUpdateAAIVfModuleRequest>""" as String - logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) - logger.debug("UpdateAAIVfModule Request: " + request) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - execution.setVariable("vfModuleFromAAI", null) - }catch(BpmnError b){ - throw b - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") - } - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(DelegateExecution execution, String action) { - - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis() - } - - def srvInstId = execution.getVariable("srvInstId") - def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) - String requestId = execution.getVariable("requestId") - String source = execution.getVariable("source") - String serviceId = execution.getVariable("serviceId") - String vnfId = execution.getVariable("vnfId") - String tenantId = execution.getVariable("tenantId") - String vfModuleId = execution.getVariable("vfModuleId") - String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc") - String vfModuleName = execution.getVariable("vfModuleName") - // Get vfModuleName from AAI response if it was not specified on the request - if (vfModuleName == null || vfModuleName.isEmpty()) { - if (execution.getVariable("vfModuleFromAAI") != null) { - org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI") - vfModuleName = vfModuleFromAAI.getVfModuleName() - } - } - String vfModuleModelName = execution.getVariable("vfModuleModelName") - String cloudSiteId = execution.getVariable("cloudSiteId") - boolean retainResources = execution.getVariable("retainResources") - String requestSubActionString = "" - if (retainResources) { - requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>" - } - String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + logger.debug("UpdateAAIVfModule Request: " + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + execution.setVariable("vfModuleFromAAI", null) + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(DelegateExecution execution, String action) { + + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis() + } + + def srvInstId = execution.getVariable("srvInstId") + def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String requestId = execution.getVariable("requestId") + String source = execution.getVariable("source") + String serviceId = execution.getVariable("serviceId") + String vnfId = execution.getVariable("vnfId") + String tenantId = execution.getVariable("tenantId") + String vfModuleId = execution.getVariable("vfModuleId") + String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc") + String vfModuleName = execution.getVariable("vfModuleName") + // Get vfModuleName from AAI response if it was not specified on the request + if (vfModuleName == null || vfModuleName.isEmpty()) { + if (execution.getVariable("vfModuleFromAAI") != null) { + org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI") + vfModuleName = vfModuleFromAAI.getVfModuleName() + } + } + String vfModuleModelName = execution.getVariable("vfModuleModelName") + String cloudSiteId = execution.getVariable("cloudSiteId") + boolean retainResources = execution.getVariable("retainResources") + String requestSubActionString = "" + if (retainResources) { + requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>" + } + String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> @@ -274,33 +272,33 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - logger.debug("sdncAdapterWorkflowRequest: " + request) - logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - - def requestId = UUID.randomUUID().toString() - def origRequestId = execution.getVariable('requestId') - def srvInstId = execution.getVariable("serviceInstanceId") - def aicCloudRegion = execution.getVariable("cloudSiteId") - def cloudOwner = execution.getVariable("cloudOwner") - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') - def tenantId = execution.getVariable("tenantId") - def messageId = execution.getVariable('requestId') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ + logger.debug("sdncAdapterWorkflowRequest: " + request) + logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + def requestId = UUID.randomUUID().toString() + def origRequestId = execution.getVariable('requestId') + def srvInstId = execution.getVariable("serviceInstanceId") + def aicCloudRegion = execution.getVariable("cloudSiteId") + def cloudOwner = execution.getVariable("cloudOwner") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') + def tenantId = execution.getVariable("tenantId") + def messageId = execution.getVariable('requestId') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> @@ -318,303 +316,301 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ </deleteVfModuleRequest> """ as String - logger.debug("vnfAdapterRestV1Request: " + request) - logger.debug("deleteVfModuleRequest: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } + logger.debug("deleteVfModuleRequest: " + request) + execution.setVariable("vnfAdapterTaskRequest", request) + } - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(DelegateExecution execution) { + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(DelegateExecution execution) { - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<UpdateAAIVfModuleRequest> + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<UpdateAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <heat-stack-id>DELETE</heat-stack-id> <orchestration-status>deleted</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - logger.debug("UpdateAAIVfModuleRequest :" + request) - logger.debug("UpdateAAIVfModuleRequest: " + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } + logger.debug("UpdateAAIVfModuleRequest: " + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<DeleteAAIVfModuleRequest> + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<DeleteAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - logger.debug("DeleteAAIVfModuleRequest :" + request) - logger.debug("DeleteAAIVfModuleRequest: " + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), - "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) - execution.setVariable("WorkflowException", exception) - } - - public void sdncValidateResponse(DelegateExecution execution, String response){ - - execution.setVariable("prefix",Prefix) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logger.debug("Successfully Validated SDNC Response") - }else{ - throw new BpmnError("MSOWorkflowException") - } - } - - public void postProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - execution.setVariable("prefix",Prefix) - try{ - logger.trace("STARTED postProcessVNFAdapterRequest Process") - - String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") - logger.debug("VNF Adapter Response is: " + vnfResponse) - logger.debug("deleteVnfAResponse is: \n" + vnfResponse) - - if(vnfResponse != null){ - - if(vnfResponse.contains("deleteVfModuleResponse")){ - logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") - execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) - - // Parse vnfOutputs for contrail network polcy FQDNs - if (vnfResponse.contains("vfModuleOutputs")) { - def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") - InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document outputsXml = docBuilder.parse(source) - - NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") - List contrailNetworkPolicyFqdnList = [] - for (int i = 0; i< entries.getLength(); i++) { - Node node = entries.item(i) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element) node - String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() - if (key.endsWith("contrail_network_policy_fqdn")) { - String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) - contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) - } - else if (key.equals("oam_management_v4_address")) { - String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) - execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) - } - else if (key.equals("oam_management_v6_address")) { - String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) - execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) - } - - } - } - if (!contrailNetworkPolicyFqdnList.isEmpty()) { - logger.debug("Setting the fqdn list") - execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) - } - } - }else{ - logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - }else{ - logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") - } - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logger.debug("Internal Error Occured in PostProcess Method") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") - } - logger.trace("COMPLETED postProcessVnfAdapterResponse Process") - } - - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - execution.setVariable("prefix", Prefix) - logger.trace("STARTED deleteNetworkPoliciesFromAAI ") - - try { - // get variables - List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") - if (fqdnList == null) { - logger.debug("No network policies to delete") - return - } - int fqdnCount = fqdnList.size() - - execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) - logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount) - - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - String fqdn = fqdnList[i] - // Query AAI for this network policy FQDN + logger.debug("DeleteAAIVfModuleRequest :" + request) + logger.debug("DeleteAAIVfModuleRequest: " + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) + execution.setVariable("WorkflowException", exception) + } + + public void sdncValidateResponse(DelegateExecution execution, String response){ + + execution.setVariable("prefix",Prefix) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + logger.debug("Successfully Validated SDNC Response") + }else{ + throw new BpmnError("MSOWorkflowException") + } + } + + public void postProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + execution.setVariable("prefix",Prefix) + try{ + logger.trace("STARTED postProcessVNFAdapterRequest Process") + + String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") + logger.debug("VNF Adapter Response is: " + vnfResponse) + logger.debug("deleteVnfAResponse is: \n" + vnfResponse) + + if(vnfResponse != null){ + + if(vnfResponse.contains("deleteVfModuleResponse")){ + logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) + + // Parse vnfOutputs for contrail network polcy FQDNs + if (vnfResponse.contains("vfModuleOutputs")) { + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document outputsXml = docBuilder.parse(source) + + NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") + List contrailNetworkPolicyFqdnList = [] + for (int i = 0; i< entries.getLength(); i++) { + Node node = entries.item(i) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node + String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) + } + + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + logger.debug("Setting the fqdn list") + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logger.debug("Internal Error Occured in PostProcess Method") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + logger.trace("COMPLETED postProcessVnfAdapterResponse Process") + } + + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + logger.trace("STARTED deleteNetworkPoliciesFromAAI ") + + try { + // get variables + List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") + if (fqdnList == null) { + logger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) + logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + String fqdn = fqdnList[i] + // Query AAI for this network policy FQDN AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) - uri.queryParam("network-policy-fqdn", fqdn) - try { - Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri) - if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) { - // This network policy FQDN exists in AAI - need to delete it now - NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0) - execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200) - // Retrieve the network policy id for this FQDN - def networkPolicyId = networkPolicy.getNetworkPolicyId() - logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) - try { - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) - getAAIClient().delete(delUri) - execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200) - } catch (Exception e) { - execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500) - String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage() - logger.debug(delErrorMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) - } - } else { - execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404) - // This network policy FQDN is not in AAI. No need to delete. - logger.debug("The return code is: " + 404) - logger.debug("This network policy FQDN is not in AAI: " + fqdn) - logger.debug("Network policy FQDN is not in AAI") - } - }catch(Exception e ) { - // aai all errors - String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage() - logger.debug(dataErrorMessage) - } - } // end loop - } else { - logger.debug("No contrail network policies to query/create") - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - - try { - def vnfId = execution.getVariable('vnfId') - def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') - def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' - - if (oamManagementV4Address != null) { - ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>' - } - - if (oamManagementV6Address != null) { - managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>' - } - - - String updateAAIGenericVnfRequest = """ + uri.queryParam("network-policy-fqdn", fqdn) + try { + Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri) + if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) { + // This network policy FQDN exists in AAI - need to delete it now + NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0) + execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200) + // Retrieve the network policy id for this FQDN + def networkPolicyId = networkPolicy.getNetworkPolicyId() + logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + try { + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) + getAAIClient().delete(delUri) + execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200) + } catch (Exception e) { + execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500) + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage() + logger.debug(delErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else { + execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404) + // This network policy FQDN is not in AAI. No need to delete. + logger.debug("The return code is: " + 404) + logger.debug("This network policy FQDN is not in AAI: " + fqdn) + logger.debug("Network policy FQDN is not in AAI") + } + }catch(Exception e ) { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage() + logger.debug(dataErrorMessage) + } + } // end loop + } else { + logger.debug("No contrail network policies to query/create") + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>' + } + + if (oamManagementV6Address != null) { + managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>' + } + + + String updateAAIGenericVnfRequest = """ <UpdateAAIGenericVnfRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> ${ipv4OamAddressElement} ${managementV6AddressElement} </UpdateAAIGenericVnfRequest> """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - - - 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, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - /** - * Using the vnfId and vfModuleId provided in the inputs, - * query AAI to get the corresponding VF Module info. - * A 200 response is expected with the VF Module info in the response body, - * Will determine VF Module's orchestration status if one exists - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModuleForStatus(DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) - - execution.setVariable(Prefix + 'orchestrationStatus', '') - - try { - def vnfId = execution.getVariable('vnfId') - def vfModuleId = execution.getVariable('vfModuleId') - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) - - try { + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + 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, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Using the vnfId and vfModuleId provided in the inputs, + * query AAI to get the corresponding VF Module info. + * A 200 response is expected with the VF Module info in the response body, + * Will determine VF Module's orchestration status if one exists + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModuleForStatus(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + + 'execution=' + execution.getId() + + ')' + logger.trace('Entered ' + method) + + execution.setVariable(Prefix + 'orchestrationStatus', '') + + try { + def vnfId = execution.getVariable('vnfId') + def vfModuleId = execution.getVariable('vfModuleId') + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + + try { Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, uri); - // Retrieve VF Module info and its orchestration status; if not found, do nothing + // Retrieve VF Module info and its orchestration status; if not found, do nothing if (vfModule.isPresent()) { execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', 200) execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', vfModule.get()) @@ -622,20 +618,20 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) logger.debug("Received orchestration status from A&AI: " + orchestrationStatus) } - } catch (Exception ex) { - logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - 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, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) - } - } + } catch (Exception ex) { + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + 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, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 34a210364a..350de4a03d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.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. @@ -53,244 +53,244 @@ import org.slf4j.LoggerFactory public class DoDeleteVfModuleFromVnf extends VfModuleBase { private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class); - def Prefix="DDVFMV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) - } - - // parse the incoming request - public void preProcessRequest(DelegateExecution execution) { - - initProcessVariables(execution) - - try { - - // Building Block-type request - - // Set mso-request-id to request-id for VNF Adapter interface - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("mso-request-id", requestId) - execution.setVariable("requestId", requestId) - logger.debug("msoRequestId: " + requestId) - String tenantId = execution.getVariable("tenantId") - logger.debug("tenantId: " + tenantId) - String cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("cloudSiteId", cloudSiteId) - logger.debug("cloudSiteId: " + cloudSiteId) - String cloudOwner = execution.getVariable("cloudOwner") - execution.setVariable("cloudOwner", cloudOwner) - logger.debug("cloudOwner: " + cloudOwner) - // Source is HARDCODED - String source = "VID" - execution.setVariable("source", source) - // isVidRequest is hardcoded to "true" - execution.setVariable("isVidRequest", "true") - // SrvInstId is hardcoded to empty - execution.setVariable("srvInstId", "") - // ServiceId is hardcoded to empty - execution.setVariable("serviceId", "") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - logger.debug("serviceInstanceId: " + serviceInstanceId) - String vnfId = execution.getVariable("vnfId") - logger.debug("vnfId: " + vnfId) - String vfModuleId = execution.getVariable("vfModuleId") - logger.debug("vfModuleId: " + vfModuleId) - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) - } - else { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) - } - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "1707" - } - execution.setVariable(Prefix + "sdncVersion", sdncVersion) - logger.debug("Incoming Sdnc Version is: " + sdncVersion) - - String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception"); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - logger.debug("SDNC Callback URL: " + sdncCallbackUrl) - logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logger.debug("Exception is: " + e.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") - } - } - - public void queryAAIForVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - - try { - def vnfId = execution.getVariable('vnfId') - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) - try { - Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri) - - if(genericVnf.isPresent()){ - execution.setVariable('DDVMFV_getVnfResponseCode', 200) - execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get()) - }else{ - execution.setVariable('DDVMFV_getVnfResponseCode', 404) - execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!") - } - } catch (Exception ex) { - logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) - execution.setVariable('DDVMFV_getVnfResponseCode', 500) - execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) - } - 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, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) - } - } - - /** - * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID - * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module - * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not - * attempting to delete it. - * - * @param execution The flow's execution instance. - */ - public void validateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logger.trace('Entered ' + method) - - try { - GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse') - def vnfId = execution.getVariable('_vnfId') - def vfModuleId = execution.getVariable('vfModuleId') + def Prefix="DDVFMV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) + } + + // parse the incoming request + public void preProcessRequest(DelegateExecution execution) { + + initProcessVariables(execution) + + try { + + // Building Block-type request + + // Set mso-request-id to request-id for VNF Adapter interface + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("mso-request-id", requestId) + execution.setVariable("requestId", requestId) + logger.debug("msoRequestId: " + requestId) + String tenantId = execution.getVariable("tenantId") + logger.debug("tenantId: " + tenantId) + String cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("cloudSiteId", cloudSiteId) + logger.debug("cloudSiteId: " + cloudSiteId) + String cloudOwner = execution.getVariable("cloudOwner") + execution.setVariable("cloudOwner", cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) + // Source is HARDCODED + String source = "VID" + execution.setVariable("source", source) + // isVidRequest is hardcoded to "true" + execution.setVariable("isVidRequest", "true") + // SrvInstId is hardcoded to empty + execution.setVariable("srvInstId", "") + // ServiceId is hardcoded to empty + execution.setVariable("serviceId", "") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + logger.debug("serviceInstanceId: " + serviceInstanceId) + String vnfId = execution.getVariable("vnfId") + logger.debug("vnfId: " + vnfId) + String vfModuleId = execution.getVariable("vfModuleId") + logger.debug("vfModuleId: " + vfModuleId) + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) + } + else { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) + } + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "1707" + } + execution.setVariable(Prefix + "sdncVersion", sdncVersion) + logger.debug("Incoming Sdnc Version is: " + sdncVersion) + + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception"); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logger.debug("Exception is: " + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + } + + public void queryAAIForVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + try { + Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri) + + if(genericVnf.isPresent()){ + execution.setVariable('DDVMFV_getVnfResponseCode', 200) + execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get()) + }else{ + execution.setVariable('DDVMFV_getVnfResponseCode', 404) + execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!") + } + } catch (Exception ex) { + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) + execution.setVariable('DDVMFV_getVnfResponseCode', 500) + execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) + } + 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, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) + } + } + + /** + * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID + * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module + * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not + * attempting to delete it. + * + * @param execution The flow's execution instance. + */ + public void validateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateVfModule(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logger.trace('Entered ' + method) + + try { + GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse') + def vnfId = execution.getVariable('_vnfId') + def vfModuleId = execution.getVariable('vfModuleId') Optional<VfModule> vfModule = Optional.empty() if(genericVnf.getVfModules()!=null && ! genericVnf.getVfModules().getVfModule().isEmpty()) { vfModule = genericVnf.getVfModules().getVfModule().stream().filter { v -> v.getVfModuleId().equals(vfModuleId) }.findFirst() } - if (!vfModule.isPresent()) { - String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg) - } else { + if (!vfModule.isPresent()) { + String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg) + } else { Boolean isOnlyVfModule = (genericVnf.getVfModules().getVfModule().size() == 1) - if (isDebugLogEnabled) { - logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule) - } - if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) { + if (isDebugLogEnabled) { + logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule) + } + if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) { String msg = 'Cannot delete VF Module \'' + vfModuleId + '\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 1002,msg) - } - def heatStackId = vfModule.get().getHeatStackId() - execution.setVariable('DDVMFV_heatStackId', heatStackId) - logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId) - } - 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, 1002, 'Error in validateVfModule(): ' + e.getMessage()) - } - } - - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - - execution.setVariable("prefix", Prefix) - logger.trace("STARTED preProcessSDNCDeactivateRequest ") - - def serviceInstanceId = execution.getVariable("serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest) - logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - execution.setVariable("prefix", Prefix) - logger.trace("STARTED preProcessSDNCUnassignRequest Process ") - try{ - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest) - logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - - }catch(Exception e){ - logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("serviceId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def vfModuleId = execution.getVariable("vfModuleId") - def source = execution.getVariable("source") - def vnfId = execution.getVariable("vnfId") - - def sdncVersion = execution.getVariable(Prefix + "sdncVersion") - - String sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + } + def heatStackId = vfModule.get().getHeatStackId() + execution.setVariable('DDVMFV_heatStackId', heatStackId) + logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId) + } + 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, 1002, 'Error in validateVfModule(): ' + e.getMessage()) + } + } + + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + logger.trace("STARTED preProcessSDNCDeactivateRequest ") + + def serviceInstanceId = execution.getVariable("serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + logger.trace("STARTED preProcessSDNCUnassignRequest Process ") + try{ + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + + }catch(Exception e){ + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("serviceId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def vfModuleId = execution.getVariable("vfModuleId") + def source = execution.getVariable("source") + def vnfId = execution.getVariable("vnfId") + + def sdncVersion = execution.getVariable(Prefix + "sdncVersion") + + String sdncRequest = + """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> @@ -312,73 +312,73 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { </request-information> <service-information> <service-id/> - <subscription-service-type/> + <subscription-service-type/> <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> <global-customer-id/> </service-information> <vnf-information> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> - <vnf-type/> + <vnf-type/> </vnf-information> <vf-module-information> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </vf-module-information> - <vf-module-request-input/> + <vf-module-request-input/> </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - - logger.debug("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - - execution.setVariable("prefix",Prefix) - logger.trace("STARTED ValidateSDNCResponse Process") - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - logger.debug("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - logger.debug("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) - }else{ - logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") - throw new BpmnError("MSOWorkflowException") - } - logger.trace("COMPLETED ValidateSDNCResponse Process") - } - - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - - def requestId = UUID.randomUUID().toString() - def origRequestId = execution.getVariable('requestId') - def srvInstId = execution.getVariable("serviceInstanceId") - def aicCloudRegion = execution.getVariable("cloudSiteId") - def cloudOwner = execution.getVariable("cloudOwner") - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId') - def tenantId = execution.getVariable("tenantId") - def messageId = execution.getVariable('requestId') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ + + logger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + execution.setVariable("prefix",Prefix) + logger.trace("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + logger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + logger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + }else{ + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + logger.trace("COMPLETED ValidateSDNCResponse Process") + } + + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + def requestId = UUID.randomUUID().toString() + def origRequestId = execution.getVariable('requestId') + def srvInstId = execution.getVariable("serviceInstanceId") + def aicCloudRegion = execution.getVariable("cloudSiteId") + def cloudOwner = execution.getVariable("cloudOwner") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId') + def tenantId = execution.getVariable("tenantId") + def messageId = execution.getVariable('requestId') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> @@ -396,126 +396,126 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { </deleteVfModuleRequest> """ as String - logger.debug("vnfAdapterRestV1Request: " + request) - logger.debug("deleteVfModuleRequest: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), - "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable("DDVFMV_deleteGenericVnfResponse")) - execution.setVariable("WorkflowException", exception) - } - - public void postProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - execution.setVariable("prefix",Prefix) - try{ - logger.trace("STARTED postProcessVNFAdapterRequest Process") - - String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse") - logger.debug("VNF Adapter Response is: " + vnfResponse) - logger.debug("deleteVnfAResponse is: \n" + vnfResponse) - - if(vnfResponse != null){ - - if(vnfResponse.contains("deleteVfModuleResponse")){ - logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") - execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true) - - // Parse vnfOutputs for contrail network polcy FQDNs - def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") - if(!isBlank(vfModuleOutputsXml)) { - vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml) - List contrailNetworkPolicyFqdnList = [] - for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) { - String key = utils.getChildNodeText(node, "key") - if(key == null) { - - } else if (key.endsWith("contrail_network_policy_fqdn")) { - String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value") - logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) - contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) - } - else if (key.equals("oam_management_v4_address")) { - String oamManagementV4Address = utils.getChildNodeText(node, "value") - logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) - execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) - } - else if (key.equals("oam_management_v6_address")) { - String oamManagementV6Address = utils.getChildNodeText(node, "value") - logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) - execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) - } - } - if (!contrailNetworkPolicyFqdnList.isEmpty()) { - logger.debug("Setting the fqdn list") - execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) - } - } - }else{ - logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - }else{ - logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") - } - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logger.debug("Internal Error Occured in PostProcess Method") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") - } - logger.trace("COMPLETED postProcessVnfAdapterResponse Process") - } - - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - - logger.trace('Entered ' + method) - execution.setVariable("prefix", Prefix) - logger.trace("STARTED deleteNetworkPoliciesFromAAI ") - - try { - // get variables - List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList") - if (fqdnList == null) { - logger.debug("No network policies to delete") - return - } - int fqdnCount = fqdnList.size() - - execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount) - logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount) - - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - - int counting = i+1 - String fqdn = fqdnList[i] - - // Query AAI for this network policy FQDN + + logger.debug("deleteVfModuleRequest: " + request) + execution.setVariable("vnfAdapterTaskRequest", request) + } + + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable("DDVFMV_deleteGenericVnfResponse")) + execution.setVariable("WorkflowException", exception) + } + + public void postProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + execution.setVariable("prefix",Prefix) + try{ + logger.trace("STARTED postProcessVNFAdapterRequest Process") + + String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse") + logger.debug("VNF Adapter Response is: " + vnfResponse) + logger.debug("deleteVnfAResponse is: \n" + vnfResponse) + + if(vnfResponse != null){ + + if(vnfResponse.contains("deleteVfModuleResponse")){ + logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true) + + // Parse vnfOutputs for contrail network polcy FQDNs + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + if(!isBlank(vfModuleOutputsXml)) { + vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml) + List contrailNetworkPolicyFqdnList = [] + for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) { + String key = utils.getChildNodeText(node, "key") + if(key == null) { + + } else if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value") + logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = utils.getChildNodeText(node, "value") + logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = utils.getChildNodeText(node, "value") + logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + logger.debug("Setting the fqdn list") + execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logger.debug("Internal Error Occured in PostProcess Method") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + logger.trace("COMPLETED postProcessVnfAdapterResponse Process") + } + + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + + logger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + logger.trace("STARTED deleteNetworkPoliciesFromAAI ") + + try { + // get variables + List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList") + if (fqdnList == null) { + logger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount) + logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount) + + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) - uri.queryParam("network-policy-fqdn", fqdn) + uri.queryParam("network-policy-fqdn", fqdn) try { Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri) @@ -555,35 +555,35 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } // end loop - } else { - logger.debug("No contrail network policies to query/create") + } else { + logger.debug("No contrail network policies to query/create") - } + } + + } catch (BpmnError e) { + throw e; - } catch (BpmnError e) { - throw e; + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } + } - } - - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """<DeleteAAIVfModuleRequest> + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """<DeleteAAIVfModuleRequest> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - logger.debug("DeleteAAIVfModuleRequest :" + request) - - execution.setVariable("DeleteAAIVfModuleRequest", request) - } + logger.debug("DeleteAAIVfModuleRequest :" + request) + + execution.setVariable("DeleteAAIVfModuleRequest", request) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy index 89490ff620..89490ff620 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy new file mode 100644 index 0000000000..8e7a4f727d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.workflow.context.WorkflowContext +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder +import org.onap.so.bpmn.core.WorkflowException +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.* + +class PNFSoftwareUpgrade extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger(PNFSoftwareUpgrade.class) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + String prefix = "PnfSwUpgrade_" + + @Override + void preProcessRequest(DelegateExecution execution) { + } + + void sendResponse(DelegateExecution execution) { + def requestId = execution.getVariable(REQUEST_ID) + def instanceId = execution.getVariable(PNF_CORRELATION_ID) + logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId) + + String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim() + sendWorkflowResponse(execution, 200, response) + } + + static WorkflowContext getWorkflowContext(DelegateExecution execution) { + String requestId = execution.getVariable(REQUEST_ID) + return WorkflowContextHolder.getInstance().getWorkflowContext(requestId) + } + + void prepareCompletion(DelegateExecution execution) { + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare Completion of PNF Software Upgrade for requestId: {}", requestId) + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:status-message>PNF has been upgraded successfully.</aetgt:status-message> + <aetgt:mso-bpel-name>PNF_SOFTWARE_UPGRADE</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + logger.debug("CompleteMsoProcessRequest of PNF Software Upgrade - " + "\n" + xmlMsoCompletionRequest) + } catch (Exception e) { + String msg = "Prepare Completion error for PNF software upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + void prepareFalloutHandler(DelegateExecution execution) { + WorkflowContext workflowContext = getWorkflowContext(execution) + if (workflowContext == null) { + logger.debug("Error occurred before sending response to API handler, and send it now") + sendResponse(execution) + } + + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare FalloutHandler of PNF Software Upgrade for requestId: {}", requestId) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(workflowException.getErrorCode()) + String errorMessage = workflowException.getErrorMessage() + String falloutHandlerRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest) + + execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest) + + logger.debug("FalloutHandlerRequest of PNF Software Upgrade - " + "\n" + xmlFalloutHandlerRequest) + } catch (Exception e) { + String msg = "Prepare FalloutHandler error for PNF software upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy index 6b7944cc6e..46f061d89c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy @@ -159,4 +159,79 @@ class CreateSliceServiceTest extends MsoGroovyTest { assertNotNull(values) } + @Test + void testPrepareDecomposeService() { + when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + CreateSliceService sliceService = new CreateSliceService() + sliceService.prepareDecomposeService(mockExecution) + + String serviceModelInfoExcept = """{ + "modelInvariantUuid":"123456", + "modelUuid":"123456", + "modelVersion":"" + }""" + Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture()) + String serviceModelInfo = captor.getValue() + assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""), + serviceModelInfo.replaceAll("\\s+", "")) + } + + @Test + void testProcessDecomposition() { + when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution) + + CreateSliceService sliceService = new CreateSliceService() + sliceService.processDecomposition(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture()) + assertEquals(captor.getValue(), "5G") + Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture()) + assertEquals(captor.getValue(), "embb") + Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture()) + assertEquals(captor.getValue(), "shared") + Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture()) + assertEquals(captor.getValue(), "aaaaaa") + Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture()) + assertEquals(captor.getValue(), "bbbbbb") + } + + @Test + void testPrepareCreateOrchestrationTask() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("test") + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + + CreateSliceService sliceService = new CreateSliceService() + sliceService.prepareCreateOrchestrationTask(mockExecution) + + SliceTaskParams sliceTaskParamsExpect = new SliceTaskParams() + sliceTaskParamsExpect.setServiceId("123456") + sliceTaskParamsExpect.setServiceName("test") + sliceTaskParamsExpect.setServiceProfile(serviceProfile) + String paramJsonExpect = sliceTaskParamsExpect.convertToJson() + + Mockito.verify(mockExecution, times(2)).setVariable(eq("subscriptionServiceType"), captor.capture()) + List allValues = captor.getAllValues() + SliceTaskParams sliceTaskParams = allValues.get(0) + String paramJson = allValues.get(1) + assertEquals(sliceTaskParams.getServiceId(), sliceTaskParams.getServiceId()) + assertEquals(sliceTaskParams.getServiceName(), sliceTaskParams.getServiceName()) + assertEquals(sliceTaskParams.getServiceProfile(), sliceTaskParams.getServiceProfile()) + assertEquals(paramJsonExpect, paramJson) + } + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + CreateSliceService sliceService = new CreateSliceService() + sliceService.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def catchSyncResponse = captor.getValue() + assertEquals(catchSyncResponse, true) + } + } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn index b7ce608090..2e5d2e30b1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeleteVfModuleVolumeInfraV1" name="DeleteVfModuleVolumeInfraV1" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> @@ -51,13 +51,12 @@ deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLo <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DELVfModVol_tenantId") == execution.getVariable("DELVfModVol_volumeGroupTenantId")}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_21" name="" sourceRef="ExclusiveGateway_3" targetRef="ScriptTask_2" /> - <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> - <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterRestV1Request" /> - <camunda:out source="vnfAdapterRestV1Response" target="DELVfModVol_deleteVnfAResponse" /> + <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="DELVfModVol_deleteVnfAResponse" /> <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 source="WorkflowException" target="WorkflowException" /> <camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" /> </bpmn2:extensionElements> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn index 24ca7104a7..5d523194bb 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn @@ -1,15 +1,15 @@ <?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4"> +<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="PNFSWUPDownload" name="PNFSWUPDownload" isExecutable="true"> <bpmn:startEvent id="download_StartEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}"> <bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="download_EndEvent" name="End"> - <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0mjjdia</bpmn:incoming> <bpmn:terminateEventDefinition id="TerminateEventDefinition_1kiurmf" /> </bpmn:endEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_1ja7grm" default="SequenceFlow_078xmlz"> @@ -32,8 +32,8 @@ </bpmn:endEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_08lusga" default="SequenceFlow_1gawssm"> <bpmn:incoming>SequenceFlow_1kaikh5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1gawssm</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="EndEvent_11hee4g"> <bpmn:incoming>SequenceFlow_1gawssm</bpmn:incoming> @@ -73,10 +73,7 @@ <bpmn:outgoing>SequenceFlow_1ccldpp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1fdclh0" sourceRef="download_StartEvent" targetRef="ServiceTask_1mpt2eq" /> - <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ServiceTask_1mpt2eq" targetRef="ServiceTask_1nl90ao" /> - <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="download_EndEvent"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ScriptTask_1ankfw8" targetRef="ServiceTask_1nl90ao" /> <bpmn:sequenceFlow id="SequenceFlow_0o6b6a8" sourceRef="ServiceTask_0yavde3" targetRef="ExclusiveGateway_1ja7grm" /> <bpmn:sequenceFlow id="SequenceFlow_078xmlz" name="Failure" sourceRef="ExclusiveGateway_1ja7grm" targetRef="EndEvent_1j64ij1" /> <bpmn:sequenceFlow id="SequenceFlow_1ccldpp" sourceRef="ServiceTask_1nl90ao" targetRef="ExclusiveGateway_1rj84ne" /> @@ -89,113 +86,229 @@ <bpmn:sequenceFlow id="SequenceFlow_0qznt4u" name="Success" sourceRef="ExclusiveGateway_1ja7grm" targetRef="ServiceTask_1wxo7xz"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:subProcess id="SubProcess_02e59i3" name="Subprocess for FalloutHandler" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0uftj43" name="Catch All Errors"> + <bpmn:outgoing>SequenceFlow_0swi04u</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_061iekb" /> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1yzq4u7" name="Prepare FalloutHandler" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0swi04u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ppn4a8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0ikcgtm" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ppn4a8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ahmdun</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_1xtb63b" name="End"> + <bpmn:incoming>SequenceFlow_1ahmdun</bpmn:incoming> + <bpmn:terminateEventDefinition id="TerminateEventDefinition_1vngo0e" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ahmdun" sourceRef="CallActivity_0ikcgtm" targetRef="EndEvent_1xtb63b" /> + <bpmn:sequenceFlow id="SequenceFlow_1ppn4a8" sourceRef="ScriptTask_1yzq4u7" targetRef="CallActivity_0ikcgtm" /> + <bpmn:sequenceFlow id="SequenceFlow_0swi04u" sourceRef="StartEvent_0uftj43" targetRef="ScriptTask_1yzq4u7" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_1ankfw8" name="Send Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0kusy70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0kusy70" sourceRef="ServiceTask_1mpt2eq" targetRef="ScriptTask_1ankfw8" /> + <bpmn:scriptTask id="ScriptTask_17f7m2t" name="Prepare Completion" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_183s0wo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0tq2dug" name="Complete Process" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_183s0wo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mjjdia</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_183s0wo" sourceRef="ScriptTask_17f7m2t" targetRef="CallActivity_0tq2dug" /> + <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="ScriptTask_17f7m2t"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0mjjdia" sourceRef="CallActivity_0tq2dug" targetRef="download_EndEvent" /> </bpmn:process> <bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSWUPDownload"> <bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent"> - <dc:Bounds x="162" y="102" width="36" height="36" /> + <dc:Bounds x="172" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="157" y="145" width="50" height="14" /> + <dc:Bounds x="167" y="146" width="50" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1mpt2eq_di" bpmnElement="ServiceTask_1mpt2eq"> - <dc:Bounds x="280" y="80" width="100" height="80" /> + <dc:Bounds x="270" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1e4dq7w_di" bpmnElement="download_EndEvent"> - <dc:Bounds x="1312" y="102" width="36" height="36" /> + <dc:Bounds x="512" y="463" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1321" y="145" width="20" height="14" /> + <dc:Bounds x="522" y="506" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1ja7grm_di" bpmnElement="ExclusiveGateway_1ja7grm" isMarkerVisible="true"> - <dc:Bounds x="895" y="95" width="50" height="50" /> + <dc:Bounds x="615" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1j64ij1_di" bpmnElement="EndEvent_1j64ij1"> - <dc:Bounds x="902" y="252" width="36" height="36" /> + <dc:Bounds x="622" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1rj84ne_di" bpmnElement="ExclusiveGateway_1rj84ne" isMarkerVisible="true"> - <dc:Bounds x="635" y="95" width="50" height="50" /> + <dc:Bounds x="355" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1ubpef4_di" bpmnElement="EndEvent_1ubpef4"> - <dc:Bounds x="642" y="252" width="36" height="36" /> + <dc:Bounds x="362" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_08lusga_di" bpmnElement="ExclusiveGateway_08lusga" isMarkerVisible="true"> - <dc:Bounds x="1155" y="95" width="50" height="50" /> + <dc:Bounds x="875" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_11hee4g_di" bpmnElement="EndEvent_11hee4g"> - <dc:Bounds x="1162" y="252" width="36" height="36" /> + <dc:Bounds x="882" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0yavde3_di" bpmnElement="ServiceTask_0yavde3"> - <dc:Bounds x="760" y="80" width="100" height="80" /> + <dc:Bounds x="480" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1wxo7xz_di" bpmnElement="ServiceTask_1wxo7xz"> - <dc:Bounds x="1000" y="80" width="100" height="80" /> + <dc:Bounds x="720" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao"> - <dc:Bounds x="480" y="80" width="100" height="80" /> + <dc:Bounds x="200" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0"> - <di:waypoint x="198" y="120" /> - <di:waypoint x="280" y="120" /> + <di:waypoint x="208" y="121" /> + <di:waypoint x="270" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6"> - <di:waypoint x="380" y="120" /> - <di:waypoint x="480" y="120" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx"> - <di:waypoint x="1205" y="120" /> - <di:waypoint x="1312" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1214" y="102" width="43" height="14" /> - </bpmndi:BPMNLabel> + <di:waypoint x="540" y="121" /> + <di:waypoint x="570" y="121" /> + <di:waypoint x="570" y="190" /> + <di:waypoint x="160" y="190" /> + <di:waypoint x="160" y="260" /> + <di:waypoint x="200" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8"> - <di:waypoint x="860" y="120" /> - <di:waypoint x="895" y="120" /> + <di:waypoint x="580" y="260" /> + <di:waypoint x="615" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz"> - <di:waypoint x="920" y="145" /> - <di:waypoint x="920" y="252" /> + <di:waypoint x="640" y="285" /> + <di:waypoint x="640" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="918" y="217" width="34" height="14" /> + <dc:Bounds x="650" y="291" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp"> - <di:waypoint x="580" y="120" /> - <di:waypoint x="635" y="120" /> + <di:waypoint x="300" y="260" /> + <di:waypoint x="355" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9"> - <di:waypoint x="685" y="120" /> - <di:waypoint x="760" y="120" /> + <di:waypoint x="405" y="260" /> + <di:waypoint x="480" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678" y="102" width="43" height="14" /> + <dc:Bounds x="398" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1"> - <di:waypoint x="660" y="145" /> - <di:waypoint x="660" y="252" /> + <di:waypoint x="380" y="285" /> + <di:waypoint x="380" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="658" y="217" width="34" height="14" /> + <dc:Bounds x="384" y="292" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5"> - <di:waypoint x="1100" y="120" /> - <di:waypoint x="1155" y="120" /> + <di:waypoint x="820" y="260" /> + <di:waypoint x="875" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm"> - <di:waypoint x="1180" y="145" /> - <di:waypoint x="1180" y="252" /> + <di:waypoint x="900" y="285" /> + <di:waypoint x="900" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1178" y="172" width="34" height="14" /> + <dc:Bounds x="912" y="290" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u"> - <di:waypoint x="945" y="120" /> - <di:waypoint x="1000" y="120" /> + <di:waypoint x="665" y="260" /> + <di:waypoint x="720" y="260" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="671" y="242" width="43" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true"> + <dc:Bounds x="190" y="580" width="650" height="190" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43"> + <dc:Bounds x="262" y="662" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="242" y="703" width="76" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1yzq4u7_di" bpmnElement="ScriptTask_1yzq4u7"> + <dc:Bounds x="360" y="640" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0ikcgtm_di" bpmnElement="CallActivity_0ikcgtm"> + <dc:Bounds x="530" y="640" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1xtb63b_di" bpmnElement="EndEvent_1xtb63b"> + <dc:Bounds x="702" y="662" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="951" y="102" width="43" height="14" /> + <dc:Bounds x="712" y="705" width="18" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun"> + <di:waypoint x="630" y="680" /> + <di:waypoint x="702" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8"> + <di:waypoint x="460" y="680" /> + <di:waypoint x="530" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u"> + <di:waypoint x="298" y="680" /> + <di:waypoint x="360" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8"> + <dc:Bounds x="440" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70"> + <di:waypoint x="370" y="121" /> + <di:waypoint x="440" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t"> + <dc:Bounds x="202" y="441" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug"> + <dc:Bounds x="355" y="441" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo"> + <di:waypoint x="302" y="481" /> + <di:waypoint x="355" y="481" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx"> + <di:waypoint x="925" y="260" /> + <di:waypoint x="970" y="260" /> + <di:waypoint x="970" y="410" /> + <di:waypoint x="160" y="410" /> + <di:waypoint x="160" y="481" /> + <di:waypoint x="202" y="481" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="938" y="242" width="43" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia"> + <di:waypoint x="455" y="481" /> + <di:waypoint x="512" y="481" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn index 8d59dac8ac..4ff0af4549 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4"> +<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="PNFSoftwareUpgrade" name="PNFSoftwareUpgrade" isExecutable="true"> <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing> @@ -8,9 +8,9 @@ <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming> <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ServiceTask_0slpahe" /> + <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ScriptTask_10klpg8" /> <bpmn:endEvent id="softwareUpgrade_endEvent" name="End"> - <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0tle5zb</bpmn:incoming> <bpmn:terminateEventDefinition /> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="softwareUpgrade_startEvent" targetRef="ServiceTask_042uz7n" /> @@ -60,7 +60,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1eljvek" name="Success" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="ServiceTask_02lxf48"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="softwareUpgrade_endEvent"> + <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="ScriptTask_1igtc83"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0eiif6e" name="Success" sourceRef="ExclusiveGateway_0ch3fef" targetRef="ServiceTask_1jo8vn7"> @@ -110,7 +110,7 @@ <camunda:inputParameter name="mode">async</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ks3p41</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpahe" targetRef="ExclusiveGateway_0x6h0ni" /> @@ -119,9 +119,59 @@ <bpmn:outgoing>SequenceFlow_084orr1</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_084orr1" sourceRef="ServiceTask_1jo8vn7" targetRef="ServiceTask_0y2uysu" /> + <bpmn:scriptTask id="ScriptTask_10klpg8" name="Send Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ks3p41</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ks3p41" sourceRef="ScriptTask_10klpg8" targetRef="ServiceTask_0slpahe" /> + <bpmn:scriptTask id="ScriptTask_1igtc83" name="Prepare Completion" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ipc3nt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ipc3nt" sourceRef="ScriptTask_1igtc83" targetRef="CallActivity_0o1mi8u" /> + <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0tle5zb" sourceRef="CallActivity_0o1mi8u" targetRef="softwareUpgrade_endEvent" /> + <bpmn:subProcess id="SubProcess_02p6q4s" name="Subprocess for FalloutHandler" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_149ecdm" name="Catch All Errors"> + <bpmn:outgoing>SequenceFlow_05haut5</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_0gov132" name="Prepare FalloutHandler" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05haut5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09y0mpc</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_00psvtk" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_09y0mpc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tcjlty</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_1vq2glg" name="End"> + <bpmn:incoming>SequenceFlow_1tcjlty</bpmn:incoming> + <bpmn:terminateEventDefinition id="TerminateEventDefinition_0994ojb" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_05haut5" sourceRef="StartEvent_149ecdm" targetRef="ScriptTask_0gov132" /> + <bpmn:sequenceFlow id="SequenceFlow_09y0mpc" sourceRef="ScriptTask_0gov132" targetRef="CallActivity_00psvtk" /> + <bpmn:sequenceFlow id="SequenceFlow_1tcjlty" sourceRef="CallActivity_00psvtk" targetRef="EndEvent_1vq2glg" /> + </bpmn:subProcess> </bpmn:process> <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmn:error id="Error_0nmskzh" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSoftwareUpgrade"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent"> @@ -131,142 +181,204 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n"> - <dc:Bounds x="280" y="80" width="100" height="80" /> + <dc:Bounds x="270" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m"> - <di:waypoint x="380" y="120" /> - <di:waypoint x="480" y="120" /> + <di:waypoint x="370" y="120" /> + <di:waypoint x="440" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent"> - <dc:Bounds x="1662" y="102" width="36" height="36" /> + <dc:Bounds x="532" y="462" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1671" y="145" width="20" height="14" /> + <dc:Bounds x="542" y="505" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l"> <di:waypoint x="198" y="120" /> - <di:waypoint x="280" y="120" /> + <di:waypoint x="270" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true"> - <dc:Bounds x="895" y="95" width="50" height="50" /> + <dc:Bounds x="615" y="235" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="1040" y="65" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0bnbfds_di" bpmnElement="EndEvent_0bnbfds"> - <dc:Bounds x="902" y="252" width="36" height="36" /> + <dc:Bounds x="622" y="342" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1044" y="295" width="34" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true"> - <dc:Bounds x="635" y="95" width="50" height="50" /> + <dc:Bounds x="355" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5"> - <di:waypoint x="685" y="120" /> - <di:waypoint x="760" y="120" /> + <di:waypoint x="405" y="260" /> + <di:waypoint x="460" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678" y="102" width="43" height="14" /> + <dc:Bounds x="408" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y"> - <dc:Bounds x="642" y="252" width="36" height="36" /> + <dc:Bounds x="362" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91"> - <di:waypoint x="660" y="145" /> - <di:waypoint x="660" y="252" /> + <di:waypoint x="380" y="285" /> + <di:waypoint x="380" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="658" y="217" width="34" height="14" /> + <dc:Bounds x="384" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu"> - <di:waypoint x="920" y="145" /> - <di:waypoint x="920" y="252" /> + <di:waypoint x="640" y="285" /> + <di:waypoint x="640" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="918" y="217" width="34" height="14" /> + <dc:Bounds x="644" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true"> - <dc:Bounds x="1125" y="95" width="50" height="50" /> + <dc:Bounds x="845" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz"> - <dc:Bounds x="1132" y="252" width="36" height="36" /> + <dc:Bounds x="852" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c"> - <di:waypoint x="1150" y="145" /> - <di:waypoint x="1150" y="252" /> + <di:waypoint x="870" y="285" /> + <di:waypoint x="870" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1148" y="230" width="34" height="14" /> + <dc:Bounds x="874" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true"> - <dc:Bounds x="1505" y="95" width="50" height="50" /> + <dc:Bounds x="1225" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5"> - <dc:Bounds x="1512" y="252" width="36" height="36" /> + <dc:Bounds x="1232" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph"> - <di:waypoint x="1530" y="145" /> - <di:waypoint x="1530" y="252" /> + <di:waypoint x="1250" y="285" /> + <di:waypoint x="1250" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1528" y="172" width="34" height="14" /> + <dc:Bounds x="1254" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek"> - <di:waypoint x="945" y="120" /> - <di:waypoint x="1010" y="120" /> + <di:waypoint x="665" y="260" /> + <di:waypoint x="720" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="938" y="102" width="43" height="14" /> + <dc:Bounds x="668" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu"> - <di:waypoint x="1555" y="120" /> - <di:waypoint x="1662" y="120" /> + <di:waypoint x="1275" y="260" /> + <di:waypoint x="1320" y="260" /> + <di:waypoint x="1320" y="410" /> + <di:waypoint x="180" y="410" /> + <di:waypoint x="180" y="480" /> + <di:waypoint x="220" y="480" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1564" y="102" width="43" height="14" /> + <dc:Bounds x="1277" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e"> - <di:waypoint x="1175" y="120" /> - <di:waypoint x="1210" y="120" /> + <di:waypoint x="895" y="260" /> + <di:waypoint x="950" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1169" y="102" width="43" height="14" /> + <dc:Bounds x="898" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8"> - <dc:Bounds x="760" y="80" width="100" height="80" /> + <dc:Bounds x="460" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih"> - <di:waypoint x="860" y="120" /> - <di:waypoint x="895" y="120" /> + <di:waypoint x="560" y="260" /> + <di:waypoint x="615" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48"> - <dc:Bounds x="1010" y="80" width="100" height="80" /> + <dc:Bounds x="720" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785"> - <di:waypoint x="1110" y="120" /> - <di:waypoint x="1125" y="120" /> + <di:waypoint x="820" y="260" /> + <di:waypoint x="845" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu"> - <dc:Bounds x="1370" y="80" width="100" height="80" /> + <dc:Bounds x="1090" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0"> - <di:waypoint x="1470" y="120" /> - <di:waypoint x="1505" y="120" /> + <di:waypoint x="1190" y="260" /> + <di:waypoint x="1225" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe"> - <dc:Bounds x="480" y="80" width="100" height="80" /> + <dc:Bounds x="220" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx"> - <di:waypoint x="580" y="120" /> - <di:waypoint x="635" y="120" /> + <di:waypoint x="320" y="260" /> + <di:waypoint x="355" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7"> - <dc:Bounds x="1210" y="80" width="100" height="80" /> + <dc:Bounds x="950" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1"> - <di:waypoint x="1310" y="120" /> - <di:waypoint x="1370" y="120" /> + <di:waypoint x="1050" y="260" /> + <di:waypoint x="1090" y="260" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8"> + <dc:Bounds x="440" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41"> + <di:waypoint x="540" y="120" /> + <di:waypoint x="570" y="120" /> + <di:waypoint x="570" y="190" /> + <di:waypoint x="180" y="190" /> + <di:waypoint x="180" y="260" /> + <di:waypoint x="220" y="260" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83"> + <dc:Bounds x="220" y="440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt"> + <di:waypoint x="320" y="480" /> + <di:waypoint x="380" y="480" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u"> + <dc:Bounds x="380" y="440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb"> + <di:waypoint x="480" y="480" /> + <di:waypoint x="532" y="480" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132"> + <dc:Bounds x="540" y="630" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk"> + <dc:Bounds x="710" y="630" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg"> + <dc:Bounds x="882" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="892" y="695" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc"> + <di:waypoint x="640" y="670" /> + <di:waypoint x="710" y="670" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty"> + <di:waypoint x="810" y="670" /> + <di:waypoint x="882" y="670" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm"> + <dc:Bounds x="442" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="422" y="693" width="76" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true"> + <dc:Bounds x="370" y="570" width="650" height="190" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5"> + <di:waypoint x="478" y="670" /> + <di:waypoint x="540" y="670" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn index 078d72a1d8..ce346e13b3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.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="_ZBLUcCkQEeaY6ZhIaNLwzg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2: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="_ZBLUcCkQEeaY6ZhIaNLwzg" 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="UpdateVfModuleVolumeInfraV1" name="UpdateVfModuleVolumeInfraV1" isExecutable="true"> <bpmn2:endEvent id="EndEvent_4" name="TheEnd"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> @@ -56,14 +56,13 @@ def uvmv = new UpdateVfModuleVolumeInfraV1() uvmv.executeMethod('prepCompletionHandlerRequest', execution, UPDVfModVol_requestId, 'UPDATE', UPDVfModVol_source, isDebugLogEnabled)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ScriptTask_prepCompletionHandlerRequest" targetRef="CallActivity_completionHandler" /> - <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:out source="vnfAdapterRestV1Response" target="UPDVfModVol_vnfAdapterRestResponse" /> + <camunda:out source="WorkflowResponse" target="UPDVfModVol_vnfAdapterRestResponse" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" /> + <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_21</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_19</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn index c16061edb2..0d1b970c62 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn @@ -224,10 +224,10 @@ doCreateVfModule.prepareCreateAAIVfModuleVolumeGroupRequest(execution)]]></bpmn2 def doCreateVfModule = new DoCreateVfModule() doCreateVfModule.preProcessVNFAdapterRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> - <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterRestV1Request" /> - <camunda:out source="vnfAdapterRestV1Response" target="DCVFM_createVnfAResponse" /> + <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="DCVFM_createVnfAResponse" /> <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" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn index 2508b31f01..e9675b89f8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.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="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2: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="_Wblj8GyfEeWUWLTvug7ZOg" 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="DoCreateVfModuleRollback" name="DoCreateVfModuleRollback" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -38,13 +38,12 @@ def dcvfmr = new DoCreateVfModuleRollback() dcvfmr.prepVNFAdapterRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" /> - <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke VNFAdapterRestV1" calledElement="vnfAdapterRestV1"> + <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" /> + <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke VNFAdapterTask" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_DoCreateVfModuleRollbackResponse" /> + <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="DoDVfMod_DoCreateVfModuleRollbackResponse" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> </bpmn2:extensionElements> @@ -375,7 +374,7 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]></bpmn2:script> def dcvfmr = new DoCreateVfModuleRollback() dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapterRestV1" targetRef="ExclusiveGateway_0ahc44p" /> + <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapter" targetRef="ExclusiveGateway_0ahc44p" /> </bpmn2:process> <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn2:message id="Message_1" name="DoCreateVfModuleRollbackRequest" /> @@ -403,7 +402,7 @@ dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep"> <dc:Bounds x="104" y="763" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1"> + <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter"> <dc:Bounds x="262" y="763" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_ScriptTask_170" targetElement="_BPMNShape_CallActivity_13"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn index a762b7ecd7..6f3dceda84 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DoCreateVfModuleVolumeRollback" name="DoCreateVfModuleVolumeRollback" isExecutable="true"> <bpmn:subProcess id="SubProcess_1p4663w" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> <bpmn:scriptTask id="ScriptTask_0by1uwk" name="Log / Print Unexpected Error" scriptFormat="groovy"> @@ -33,10 +33,9 @@ doCreateVfModuleVolumeRollback.processJavaException(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0h7k68j</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_10dawse</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterRestV1"> + <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterTask"> <bpmn:extensionElements> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterRestV1Request" /> + <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterTaskRequest" /> <camunda:out source="workflowException" target="workflowException" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn index 26a4112d59..58ea0c4951 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn @@ -63,15 +63,14 @@ def doCreateVfModuleVolumeV2 = new DoCreateVfModuleVolumeV2() doCreateVfModuleVolumeV2.executeMethod('callRESTCreateAAIVolGrpName', execution, isDebugLogEnabled)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_callRestAaiCreateVolumeGrp" targetRef="ScriptTask_prepareVnfAdapterCreate" /> - <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> - <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterRestV1Request" /> + <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterTaskRequest" /> <camunda:in source="msoRequestId" target="mso-request-id" /> <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> - <camunda:out source="vnfAdapterRestV1Response" target="DCVFMODVOLV2_createVnfAResponse" /> + <camunda:out source="WorkflowResponse" target="DCVFMODVOLV2_createVnfAResponse" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="VNFREST_vnfAdapterStatusCode" target="DCVFMODVOLV2_createVnfAReturnCode" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> <camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 1149cc9ea9..85fe3b4b29 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.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.4.1"> <bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true"> <bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow"> <bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing> @@ -131,6 +131,7 @@ dcsi.postDecomposeService(execution)</bpmn:script> <camunda:in source="operationType" target="operationType" /> <camunda:in source="operationId" target="operationId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn index 848796c0b6..6026fc84b3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.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="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2: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="_Wblj8GyfEeWUWLTvug7ZOg" 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="DoDeleteVfModule" name="DoDeleteVfModule" isExecutable="true"> <bpmn2:scriptTask id="UpdateAAIVfModulePrep" name="UpdateAAIVfModule
Prep" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0fp1wqz</bpmn2:incoming> @@ -30,7 +30,7 @@ dvm.prepUpdateAAIVfModule(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_029ioyr</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14xn858</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" /> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterTask" /> <bpmn2:callActivity id="InvokeSDNCAdapterV1_2" name="Invoke
SDNCAdapterV1" calledElement="sdncAdapter"> <bpmn2:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> @@ -60,12 +60,11 @@ def dvm = new DoDeleteVfModule() dvm.prepSDNCAdapterRequest(execution, "delete")]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="InvokeSDNCAdapterV1_2" /> - <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke
VNFAdapterRestV1" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="InvokeVNFAdapterTask" name="Invoke VNFAdapterTask" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_doDeleteVfModuleResponse" /> + <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="DoDVfMod_doDeleteVfModuleResponse" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> </bpmn2:extensionElements> @@ -182,7 +181,7 @@ doDeleteVfModule.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script> def dvm = new DoDeleteVfModule() dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" /> + <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterTask" targetRef="PostProcessVNFAdapterRequest" /> <bpmn2:sequenceFlow id="SequenceFlow_14xn858" sourceRef="InvokePrepareUpdateAAIVfModule" targetRef="VNFAdapterPrep" /> </bpmn2:process> <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -221,7 +220,7 @@ dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep"> <dc:Bounds x="193" y="206" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1"> + <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterTask"> <dc:Bounds x="404" y="206" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_171" bpmnElement="UpdateAAIVfModulePrep"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn index b7a1373fe9..918964f8f8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn @@ -1,7 +1,7 @@ <?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="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2: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="_Wblj8GyfEeWUWLTvug7ZOg" 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="DoDeleteVfModuleFromVnf" name="DoDeleteVfModuleFromVnf" isExecutable="true"> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" /> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" /> <bpmn2:callActivity id="callSDNCAdapterTopologyUnassign" name="Call SDNC Adapter Topology Unassign" calledElement="sdncAdapter"> <bpmn2:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> @@ -31,12 +31,11 @@ def ddvmfv = new DoDeleteVfModuleFromVnf() ddvmfv.preProcessSDNCUnassignRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="callSDNCAdapterTopologyUnassign" /> - <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke
VNFAdapterRestV1" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke VNFAdapter" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="vnfAdapterRestV1Response" target="DDVMFV_doDeleteVfModuleResponse" /> + <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" /> + <camunda:out source="WorkflowResponse" target="DDVMFV_doDeleteVfModuleResponse" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> </bpmn2:extensionElements> @@ -83,7 +82,7 @@ ddvmfv.postProcessVNFAdapterRequest(execution)]]></bpmn2:script> </bpmn2:startEvent> <bpmn2:sequenceFlow id="SequenceFlow_0y4td40" sourceRef="preProcessSDNCDeactivateRequest" targetRef="callSDNCAdapterTopologyDeactivate" /> <bpmn2:sequenceFlow id="SequenceFlow_12q2r4i" sourceRef="callSDNCAdapterTopologyDeactivate" targetRef="postProcessSDNCDeactivateRequest" /> - <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" /> + <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapter" targetRef="PostProcessVNFAdapterRequest" /> <bpmn2:sequenceFlow id="SequenceFlow_0kx9e3s" sourceRef="postProcessSDNCDeactivateRequest" targetRef="VNFAdapterPrep" /> <bpmn2:sequenceFlow id="SequenceFlow_0ltm4jt" sourceRef="DeleteNetworkPoliciesFromAAI" targetRef="SDNCAdapterPrep2" /> <bpmn2:scriptTask id="preProcessSDNCDeactivateRequest" name="PreProcess SDNC Deactivate Request" scriptFormat="groovy"> @@ -187,7 +186,7 @@ ddvmfv.prepDeleteAAIVfModule(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep"> <dc:Bounds x="125" y="330" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1"> + <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter"> <dc:Bounds x="281" y="330" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_172" bpmnElement="SDNCAdapterPrep2"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn index 4409f2a0dc..e7706c20e6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DoDeleteVfModuleVolumeV2" name="DoDeleteVfModuleVolumeV2" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="Start"> <bpmn:outgoing>SequenceFlow_1gvfdp4</bpmn:outgoing> @@ -25,21 +25,20 @@ deleteVfMod.executeMethod('callRESTQueryAAIForVolumeGroup', execution, isDebugLo def deleteVfMod = new DoDeleteVfModuleVolumeV2() deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLogEnabled)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterRestV1"> + <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterTask"> <bpmn:extensionElements> - <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterRestV1Request" /> + <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterTaskRequest" /> <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 source="vnfAdapterRestV1Response" target="DDVMV_deleteVnfAResponse" /> + <camunda:out source="WorkflowResponse" target="DDVMV_deleteVnfAResponse" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1tgngf7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1x3luyj</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_04zsr0f</bpmn:outgoing> </bpmn:callActivity> <bpmn:scriptTask id="Task_17q1roq" name="Call REST AAI Delete Volume Group" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0cy0y9t</bpmn:incoming> + <bpmn:incoming>SequenceFlow_04zsr0f</bpmn:incoming> <bpmn:outgoing>SequenceFlow_13c3cv2</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def deleteVfMod = new DoDeleteVfModuleVolumeV2() @@ -61,20 +60,6 @@ deleteVfMod.executeMethod('preProcessRequest', execution, isDebugLogEnabled) </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1gvfdp4" sourceRef="StartEvent_1" targetRef="Task_1i432ud" /> <bpmn:sequenceFlow id="SequenceFlow_1vy2ojp" sourceRef="Task_1i432ud" targetRef="Task_06u1lr0" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0o3lxtf" name="VNF Adapter REST call success?"> - <bpmn:incoming>SequenceFlow_1x3luyj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0cy0y9t</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1rgd8dg</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1x3luyj" sourceRef="Task_14fsstq" targetRef="ExclusiveGateway_0o3lxtf" /> - <bpmn:sequenceFlow id="SequenceFlow_0cy0y9t" name="Yes" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="Task_17q1roq"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{VNFREST_SuccessIndicator == true}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="EndEvent_00cohim" name="throw MSOException"> - <bpmn:incoming>SequenceFlow_1rgd8dg</bpmn:incoming> - <bpmn:errorEventDefinition errorRef="Error_0fa7ks7" /> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1rgd8dg" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="EndEvent_00cohim" /> <bpmn:scriptTask id="Task_018w43g" name="Post Process" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_13c3cv2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1sgtwr2</bpmn:outgoing> @@ -84,6 +69,7 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn: </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_13c3cv2" sourceRef="Task_17q1roq" targetRef="Task_018w43g" /> <bpmn:sequenceFlow id="SequenceFlow_1sgtwr2" sourceRef="Task_018w43g" targetRef="EndEvent_0fw1gkf" /> + <bpmn:sequenceFlow id="SequenceFlow_04zsr0f" sourceRef="Task_14fsstq" targetRef="Task_17q1roq" /> </bpmn:process> <bpmn:error id="Error_0fa7ks7" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -153,39 +139,6 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn: <dc:Bounds x="377" y="95" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0o3lxtf_di" bpmnElement="ExclusiveGateway_0o3lxtf" isMarkerVisible="true"> - <dc:Bounds x="1028" y="95" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1020" y="145" width="66" height="36" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1x3luyj_di" bpmnElement="SequenceFlow_1x3luyj"> - <di:waypoint xsi:type="dc:Point" x="965" y="120" /> - <di:waypoint xsi:type="dc:Point" x="1028" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="997" y="95" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0cy0y9t_di" bpmnElement="SequenceFlow_0cy0y9t"> - <di:waypoint xsi:type="dc:Point" x="1078" y="120" /> - <di:waypoint xsi:type="dc:Point" x="1151" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1106" y="95" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0zln0ww_di" bpmnElement="EndEvent_00cohim"> - <dc:Bounds x="1035" y="274" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1016" y="310" width="73" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1rgd8dg_di" bpmnElement="SequenceFlow_1rgd8dg"> - <di:waypoint xsi:type="dc:Point" x="1053" y="145" /> - <di:waypoint xsi:type="dc:Point" x="1053" y="274" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1068" y="199.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1ilduoy_di" bpmnElement="Task_018w43g"> <dc:Bounds x="1298" y="80" width="100" height="80" /> </bpmndi:BPMNShape> @@ -203,6 +156,13 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn: <dc:Bounds x="1431" y="95" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04zsr0f_di" bpmnElement="SequenceFlow_04zsr0f"> + <di:waypoint xsi:type="dc:Point" x="965" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1151" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1058" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn index 46e7ddcbe6..cfda2ad73c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.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="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2: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="_Wblj8GyfEeWUWLTvug7ZOg" 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="DoUpdateVfModule" name="DoUpdateVfModule" isExecutable="true"> <bpmn2:documentation><![CDATA[This flow expects its incoming request to be in the variable 'DoUpdateVfModuleRequest'. This flow produces no output.]]></bpmn2:documentation> <bpmn2:scriptTask id="PrepareUpdateAAIVfModule_prep" name="Prepare Update AAI Vf Module (prep)" scriptFormat="groovy"> @@ -121,8 +121,7 @@ duvm.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="CallActivity_1" targetRef="ScriptTask_10" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update - Generic Vnf?" default="SequenceFlow_14"> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update
Generic Vnf?" default="SequenceFlow_14"> <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> @@ -157,14 +156,13 @@ duvm.prepSDNCTopologyChg(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterRestV1"> + <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterTask"> <bpmn2:extensionElements> - <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" /> + <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="vnfAdapterRestV1Response" target="DOUPVfMod_vnfAdapterRestResponse" /> + <camunda:out source="WorkflowResponse" target="DOUPVfMod_vnfAdapterRestResponse" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_21</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> @@ -248,8 +246,7 @@ def duvm = new DoUpdateVfModule() duvm.prepConfirmVolumeGroupTenant(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_2" targetRef="ScriptTask_3" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId - present?" default="SequenceFlow_16"> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId
present?" default="SequenceFlow_16"> <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java index a9bf4352bf..2993ed6724 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade"; private static final AAIVersion VERSION = AAIVersion.LATEST; private static final Map<String, Object> executionVariables = new HashMap(); + private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5"; private final String[] actionNames = new String[4]; private String requestObject; private String responseObject; @@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json"); executionVariables.put("bpmnRequest", requestObject); + executionVariables.put("requestId", REQUEST_ID); /** * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}. @@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { public void workflow_validInput_expectedOutput() throws InterruptedException { mockCatalogDb(); + mockRequestDb(); mockAai(); final String msoRequestId = UUID.randomUUID().toString(); @@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { // Layout is to reflect the bpmn visual layout assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", - "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", - "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", - "softwareUpgrade_endEvent"); + "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", + "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", + "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 4); @@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); } + private void mockRequestDb() { + /** + * Update Request DB + */ + wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID))); + + } + /** * Mock the catalobdb rest interface. */ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 7e5cf19b21..b6ab9d0ce6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -188,6 +188,15 @@ public class AAIUpdateTasks { } /** + * BPMN access method to update status of VfModule to Active in AAI + */ + public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { + execution.setVariable("aaiActivateVfModuleRollback", false); + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ACTIVE); + execution.setVariable("aaiActivateVfModuleRollback", true); + } + + /** * BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule */ public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) { @@ -205,9 +214,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Assigned in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.ASSIGNED); @@ -215,9 +221,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Active in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.ACTIVE); @@ -225,9 +228,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Created in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.CREATED); @@ -262,9 +262,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network Collection to Active in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) { execution.setVariable("aaiNetworkCollectionActivateRollback", false); @@ -285,27 +282,7 @@ public class AAIUpdateTasks { } /** - * BPMN access method to update status of VfModule to Active in AAI - * - * @param execution - */ - public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { - execution.setVariable("aaiActivateVfModuleRollback", false); - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); - execution.setVariable("aaiActivateVfModuleRollback", true); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - /** * BPMN access method to update HeatStackId of VfModule in AAI - * - * @param execution */ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { try { @@ -325,9 +302,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was created in cloud - * - * @param execution - * @throws Exception */ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception { execution.setVariable("aaiNetworkActivateRollback", false); @@ -369,9 +343,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was updated in cloud - * - * @param execution - * @throws Exception */ public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); @@ -399,8 +370,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network Object - * - * @param execution */ public void updateObjectNetwork(BuildingBlockExecution execution) { try { @@ -414,8 +383,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ServiceInstance - * - * @param execution */ public void updateServiceInstance(BuildingBlockExecution execution) { try { @@ -430,8 +397,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Vnf Object - * - * @param execution */ public void updateObjectVnf(BuildingBlockExecution execution) { try { @@ -445,8 +410,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of VfModuleRollback as true - * - * @param execution */ public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeleteVfModuleRollback", false); @@ -454,9 +417,6 @@ public class AAIUpdateTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModule.setHeatStackId(""); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - - VfModule copiedVfModule = vfModule.shallowCopyId(); - copiedVfModule.setHeatStackId(""); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); execution.setVariable("aaiDeleteVfModuleRollback", true); } catch (Exception ex) { @@ -467,8 +427,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Model of VfModule - * - * @param execution */ public void updateModelVfModule(BuildingBlockExecution execution) { try { @@ -483,8 +441,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) { try { @@ -499,8 +455,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { @@ -515,8 +469,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to deactive in AAI - * - * @param execution */ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { try { @@ -532,8 +484,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Ipv4OamAddress of Vnf - * - * @param execution */ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) { try { @@ -555,8 +505,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ManagementV6Address of Vnf - * - * @param execution */ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) { try { @@ -578,8 +526,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ContrailServiceInstanceFqdn of VfModule - * - * @param execution */ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) { try { @@ -598,8 +544,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of Vnf to ConfigAssigned in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) { try { @@ -613,79 +557,16 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of Vnf to Configure in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE); - - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURE); } /** * BPMN access method to update status of Vnf to configured in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - /** - * BPMN access method to update status of VNF/VF-Module based on SO scope and action. - * - * @param execution - BuildingBlockExecution - * @param scope - SO scope (vnf/vfModule) - * @param action - action (configAssign/configDeploy/configUndeploy etc..) - */ - public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - OrchestrationStatus status = getOrchestrationStatus(action); - switch (scope) { - case "vnf": - aaiVnfResources.updateOrchestrationStatusVnf(vnf, status); - break; - case "vfModule": - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status); - break; - default: - throw new IllegalArgumentException( - "Invalid scope to update orchestration status for CDS : " + action); - } - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - private OrchestrationStatus getOrchestrationStatus(String action) { - /** - * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is - * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have - * only one generic status for all actions ? - */ - - switch (action) { - case "configAssign": - return OrchestrationStatus.ASSIGNED; - case "configDeploy": - return OrchestrationStatus.CONFIGURED; - default: - throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED); } private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) { @@ -751,5 +632,4 @@ public class AAIUpdateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } - } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 8b78560521..97d78b5ee8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -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. @@ -91,7 +91,7 @@ public class VnfAdapterImpl { public void postProcessVnfAdapter(BuildingBlockExecution execution) { try { - String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response"); + String vnfAdapterResponse = execution.getVariable("WorkflowResponse"); if (!StringUtils.isEmpty(vnfAdapterResponse)) { Object vnfRestResponse = unMarshal(vnfAdapterResponse); if (vnfRestResponse instanceof CreateVfModuleResponse) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 9697246b03..9c55d0a922 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -1,7 +1,9 @@ package org.onap.so.bpmn.infrastructure.appc.tasks; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; @@ -29,6 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class AppcOrchestratorPreProcessor { @@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor { appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion); String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout"); appcTaskRequest.setOperationsTimeout(operationsTimeout); - } + Map<String, String> configMap = new HashMap<>(); + ObjectMapper objectMapper = new ObjectMapper(); + String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters"); + if (configParamsStr != null) { + configMap = + objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {}); + } + appcTaskRequest.setConfigParams(configMap); + } ControllerSelectionReference controllerSelectionReference = catalogDbClient .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); String controllerType = null; @@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor { .isEmpty()) { errorMessage = "APPC action Snapshot is missing vserverId parameter. "; } - break; } + break; + case ConfigModify: + if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) { + errorMessage = "APPC action ConfigModify is missing Configuration parameters. "; + } + break; default: break; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java index 8499b6f7d1..ea3405d423 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix - * Modifications Copyright (C) 2020 Huawei + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.PayloadGenerationException; import org.onap.so.client.sdnc.common.SDNCConstants; import org.onap.so.client.sdnc.lcm.*; import org.onap.so.client.sdnc.lcm.beans.*; @@ -59,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE { logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(), execution.getCurrentActivityName()); - boolean result; try { LcmInput lcmInput = buildLcmInput(execution); - if (lcmInput != null) { - result = sendLcmRequest(execution, lcmInput); - } else { - logger.error("Build LCM Input error"); - result = false; - } - } catch (Exception e) { - logger.error("Call SDNC LCM Client failure: ", e); - result = false; - } + sendLcmRequest(execution, lcmInput); - if (result) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success"); - } else { + } catch (Exception e) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure"); + + exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e); } + logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(), + execution.getCurrentActivityName()); + return 0; } @@ -87,17 +83,24 @@ public class SdncControllerDE extends LcmControllerDE { return SDNC_DELEGATE_EXECUTION_ERROR_CODE; } - private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmRestClient sdncLcmRestClient; try { sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmRestClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } - return sdncLcmRestClient.sendRequest(lcmInput); + LcmOutput lcmOutput; + try { + lcmOutput = sdncLcmRestClient.sendRequest(lcmInput); + } catch (Exception e) { + logger.error("SDNCLcmRestClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); + } + return lcmOutput; } private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) { @@ -115,22 +118,22 @@ public class SdncControllerDE extends LcmControllerDE { return null; } - private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmDmaapClient sdncLcmDmaapClient; try { sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient(); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmDmaapClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput); try { sdncLcmDmaapClient.sendRequest(lcmDmaapRequest); } catch (Exception e) { - logger.error("SDNCLcmDmaapClient sends request error: ", e); - return null; + logger.error("SDNCLcmDmaapClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); } long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout(); @@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE { long stopTime = System.currentTimeMillis(); if ((stopTime - startTime) > timeout) { - logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction()); - return null; + String msg = "Timeout for SDNC LCM action " + lcmInput.getAction(); + logger.error(msg); + throw new BadResponseException(msg); } } } @@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE { return lcmAction.replaceAll(regex, replacement).toLowerCase(); } - private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException { + private String convertToSting(Object msgObject) throws PayloadGenerationException { + try { + return SDNCLcmPayloadBuilder.convertToSting(msgObject); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } + } + + private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException { String requestId = String.valueOf(execution.getVariable(REQUEST_ID)); String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION)); String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID)); @@ -176,32 +188,33 @@ public class SdncControllerDE extends LcmControllerDE { UpgradePreCheckPayload upgradePreCheckPayload; upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload); + lcmPayload = convertToSting(upgradePreCheckPayload); break; case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW: lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW; DownloadNESwPayload downloadNESwPayload; downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload); + lcmPayload = convertToSting(downloadNESwPayload); break; case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW: lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW; ActivateNESwPayload activateNESwPayload; activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload); + lcmPayload = convertToSting(activateNESwPayload); break; case SoPropertyConstants.ACTION_POST_CHECK: lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK; UpgradePostCheckPayload upgradePostCheckPayload; upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload); + lcmPayload = convertToSting(upgradePostCheckPayload); break; default: - logger.error("Unsupported SO Action: " + requestAction); - return null; + String msg = "Unsupported SO Action: " + requestAction; + logger.error(msg); + throw new PayloadGenerationException(msg); } String subRequestId = UUID.randomUUID().toString(); @@ -209,32 +222,33 @@ public class SdncControllerDE extends LcmControllerDE { SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload); ObjectMapper mapper = new ObjectMapper(); - String lcmInputMsg = mapper.writeValueAsString(lcmInput); - logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg); + try { + String lcmInputMsg = mapper.writeValueAsString(lcmInput); + logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } return lcmInput; } - private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) { - if (lcmOutput == null) { - logger.error("Call SDNC LCM API failure"); - return false; - } - + private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException { LcmStatus lcmStatus = lcmOutput.getStatus(); + int lcmStatusCode = lcmStatus.getCode(); String outputPayload = lcmOutput.getPayload(); - logger.debug("SDNC LCM output payload of action {}: {}", lcmAction, outputPayload); - if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { - logger.debug("Call SDNC LCM API for {} success, message: {}", lcmAction, lcmStatus.getMessage()); - return true; + if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { + logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction, + lcmStatusCode, lcmStatus.getMessage(), outputPayload); } else { - logger.error("Call SDNC LCM API for {} failure, message: {}", lcmAction, lcmStatus.getMessage()); - return false; + String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s", + lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload); + logger.error(msg); + throw new BadResponseException(msg); } } - private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) { + private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException { String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE)); String lcmOperation = toLowerHyphen(lcmInput.getAction()); @@ -245,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE { lcmOutput = sendSyncRequest(lcmOperation, lcmInput); } - return parseLcmOutput(lcmOutput, lcmInput.getAction()); + parseLcmOutput(lcmOutput, lcmInput.getAction()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index d9f5e65ba3..cdba6e0e2f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -173,7 +173,7 @@ public class ManualHandlingTasks { taskVariables.put(TASK_VARIABLE_DESCRIPTION, description); TaskService taskService = execution.getProcessEngineServices().getTaskService(); - taskService.setVariables(taskId, taskVariables); + taskService.setVariablesLocal(taskId, taskVariables); logger.debug("successfully created fallout task: " + taskId); } catch (BpmnError e) { logger.debug(BPMN_EXCEPTION + e.getMessage()); @@ -223,7 +223,7 @@ public class ManualHandlingTasks { taskVariables.put(TASK_VARIABLE_VALID_RESPONSES, validResponses); TaskService taskService = execution.getProcessEngineServices().getTaskService(); - taskService.setVariables(taskId, taskVariables); + taskService.setVariablesLocal(taskId, taskVariables); logger.debug("successfully created pause task: " + taskId); } catch (BpmnError e) { logger.debug(BPMN_EXCEPTION + e.getMessage()); 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 eead1761ea..e01149f981 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 @@ -83,7 +83,6 @@ import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.Pnfs; 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; @@ -169,18 +168,6 @@ public class WorkflowAction { } public void selectExecutionList(DelegateExecution execution) throws Exception { - final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION); - final String vnfType = (String) execution.getVariable(VNF_TYPE); - String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); - final String createInstanceAction = "createInstance"; - final String serviceType = - Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse(""); - - List<OrchestrationFlow> orchFlows = - (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW); - WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); - List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); - List<Resource> resourceList = new ArrayList<>(); execution.setVariable("sentSyncResponse", false); execution.setVariable("homing", false); execution.setVariable("calledHoming", false); @@ -205,8 +192,9 @@ public class WorkflowAction { WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); String resourceId = ""; - final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); - if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction) + String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); + WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); + if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance") && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) { resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType, sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(), @@ -214,6 +202,7 @@ public class WorkflowAction { } else { resourceId = resource.getResourceId(); } + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) { serviceInstanceId = resourceId; } @@ -232,10 +221,16 @@ public class WorkflowAction { "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found"); } } else { + String vnfType = (String) execution.getVariable(VNF_TYPE); String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration()); + List<OrchestrationFlow> orchFlows = + (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW); + final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION); + final String serviceType = + Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse(""); if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { - orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true, cloudOwner, serviceType); } String key = ""; @@ -248,12 +243,12 @@ public class WorkflowAction { } } boolean isConfiguration = isConfiguration(orchFlows); - Resource resourceKey = new Resource(resourceType, key, aLaCarte); + Resource resourceKey = new Resource(resourceType, key, true); if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) { List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks( new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows) .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion) - .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte) + .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true) .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds) .setRequestDetails(requestDetails).setExecution(execution)); @@ -269,19 +264,21 @@ public class WorkflowAction { orchFlows = getVfModuleReplaceBuildingBlocks( new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows) .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion) - .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte) + .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true) .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds) .setRequestDetails(requestDetails).setExecution(execution)); } for (OrchestrationFlow orchFlow : orchFlows) { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, - apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, + apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, requestDetails, false, null, null, false); flowsToExecute.add(ebb); } } else { boolean foundRelated = false; boolean containsService = false; + List<Resource> resourceList = new ArrayList<>(); + List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) { // SERVICE-MACRO-ASSIGN will always get user params with a // service. @@ -440,13 +437,6 @@ public class WorkflowAction { 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<>(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index 9de8e184f2..614401d32a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -22,18 +22,33 @@ package org.onap.so.client.aai.mapper; -import org.modelmapper.ModelMapper; -import org.modelmapper.PropertyMap; -import org.onap.aai.domain.yang.RouteTargets; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; -import org.springframework.stereotype.Component; import java.util.List; import org.modelmapper.Converter; +import org.modelmapper.ModelMapper; +import org.modelmapper.PropertyMap; import org.modelmapper.spi.MappingContext; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.springframework.stereotype.Component; @Component public class AAIObjectMapper { @@ -46,6 +61,7 @@ public class AAIObjectMapper { protected void configure() { map().setServiceType(source.getModelInfoServiceInstance().getServiceType()); map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole()); + map().setServiceFunction(source.getModelInfoServiceInstance().getServiceFunction()); map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid()); map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid()); map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext()); @@ -178,6 +194,7 @@ public class AAIObjectMapper { private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets = new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() { + @Override public org.onap.aai.domain.yang.Subnets convert( MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) { return mapToAAISubNets(context.getSource()); @@ -186,6 +203,7 @@ public class AAIObjectMapper { private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments = new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() { + @Override public org.onap.aai.domain.yang.CtagAssignments convert( MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) { return mapToAAICtagAssignmentList(context.getSource()); @@ -194,6 +212,7 @@ public class AAIObjectMapper { private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments = new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() { + @Override public org.onap.aai.domain.yang.SegmentationAssignments convert( MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) { return mapToAAISegmentationAssignmentList(context.getSource()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 97a9388f8d..16e8c2de7d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -103,7 +103,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest() { - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn()); @@ -119,20 +119,20 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>"); + execution.setVariable("WorkflowResponse", "<vfModuleStackId></vfModuleStackId>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() { - execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>"); + execution.setVariable("WorkflowResponse", "<createVfModuleResponse></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -140,7 +140,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -156,7 +156,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); assertEquals(vfModule.getContrailServiceInstanceFqdn(), ""); @@ -170,7 +170,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -183,14 +183,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_ResponseNullTest() { - execution.setVariable("vnfAdapterRestV1Response", null); + execution.setVariable("WorkflowResponse", null); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @Test public void postProcessVnfAdapter_ResponseEmptyTest() { - execution.setVariable("vnfAdapterRestV1Response", ""); + execution.setVariable("WorkflowResponse", ""); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @@ -198,7 +198,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); @@ -207,14 +207,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>"); + execution.setVariable("WorkflowResponse", "<vfModuleDeleted></vfModuleDeleted>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>"); + execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); } @@ -230,7 +230,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateVolumeResponseTest() { - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); } @@ -238,7 +238,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>"); + execution.setVariable("WorkflowResponse", "<createVolumeGroupResponse></createVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(volumeGroup.getHeatStackId()); } @@ -246,7 +246,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(volumeGroup.getHeatStackId()); } @@ -255,7 +255,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); @@ -264,14 +264,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>"); + execution.setVariable("WorkflowResponse", "<volumeGroupDeleted></volumeGroupDeleted>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>"); + execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); } @@ -281,7 +281,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE); expectedException.expect(BpmnError.class); vnfAdapterImpl.postProcessVnfAdapter(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java index c78b652bd0..ea1f7b47ad 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java @@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.policy.JettisonStyleMapperProvider; @@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { genericVnf.setIpv4OamAddress("127.0.0.1"); return genericVnf; } + + @Test + public void buildAppcTaskRequestConfigModifyTest() throws Exception { + final String expectedRequestJson = + new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json"))); + ApplicationControllerTaskRequest expectedTaskRequest = + mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class); + execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST"); + fillRequiredAppcExecutionFieldsConfigModify(); + GenericVnf genericVnf = getTestGenericVnf(); + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + mockReferenceResponseForConfigModify(); + execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST"); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("VF-MODULE-ID"); + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify"); + ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest"); + assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest)); + } + + private void fillRequiredAppcExecutionFieldsConfigModify() { + RequestContext context = new RequestContext(); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setPayload( + "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}"); + context.setRequestParameters(requestParameters); + context.setMsoRequestId("TEST-MSO-ID"); + execution.setVariable("aicIdentity", "AIC-TEST"); + execution.setVariable("vmIdList", "VM-ID-LIST-TEST"); + execution.setVariable("vserverIdList", "VSERVER-ID-LIST"); + execution.setVariable("identityUrl", "IDENTITY-URL-TEST"); + execution.getGeneralBuildingBlock().setRequestContext(context); + } + + private void mockReferenceResponseForConfigModify() { + ControllerSelectionReference reference = new ControllerSelectionReference(); + reference.setControllerName("APPC"); + when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"), + eq(Action.ConfigModify.toString()))).thenReturn(reference); + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java index b6dcd96534..e3bbd11cc4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java @@ -100,7 +100,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest { when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices); when(processEngineServices.getTaskService()).thenReturn(taskService); manualHandlingTasks.setFalloutTaskVariables(task); - verify(taskService, times(1)).setVariables(any(String.class), any(Map.class)); + verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class)); } @Test @@ -110,7 +110,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest { when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices); when(processEngineServices.getTaskService()).thenReturn(taskService); manualHandlingTasks.setPauseTaskVariables(task); - verify(taskService, times(1)).setVariables(any(String.class), any(Map.class)); + verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class)); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index dc64e4ee48..1e58a83f0a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -138,6 +138,7 @@ public class AAIObjectMapperTest { ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); modelInfoServiceInstance.setServiceType("SITYPE"); modelInfoServiceInstance.setServiceRole("SIROLE"); + modelInfoServiceInstance.setServiceFunction("SIFUNCTION"); modelInfoServiceInstance.setModelInvariantUuid("MIUUID"); modelInfoServiceInstance.setModelUuid("MUUID"); modelInfoServiceInstance.setEnvironmentContext("EC"); @@ -163,6 +164,8 @@ public class AAIObjectMapperTest { serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); assertEquals(AAIServiceInstance.getWorkloadContext(), serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + assertEquals(AAIServiceInstance.getServiceFunction(), + serviceInstance.getModelInfoServiceInstance().getServiceFunction()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 109dc55294..ccd4376a10 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 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 a482da5158..9dfc245f68 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json index 19d42dddb9..4c97dbc53c 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -19,7 +19,7 @@ "allocationPools": [{ "start": "107.244.64.2", "end": "107.244.64.16" - }] + }] } ], "providerVlanNetwork": { 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 b57c8341f1..3ba5627b38 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 @@ -14,13 +14,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "vnf_id": "vnfId", "vnf_name": "vnfName", 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 da826b8a89..3fbf026176 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 @@ -12,13 +12,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "environment_context": "environmentContext", "key1": "value1", 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 54f6e403ed..9f554490bd 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 @@ -14,13 +14,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "vnf_id": "vnfId", "vnf_name": "vnfName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json new file mode 100644 index 0000000000..040c680d1c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json @@ -0,0 +1,13 @@ +{ + "ApplicationControllerTaskRequest": { + "controllerType": "APPC", + "action": "ConfigModify", + "identityUrl": "IDENTITY-URL-TEST", + "applicationControllerVnf": { + "vnfId": "TEST-VNF-ID", + "vnfName": "TEST-VNF-NAME", + "vnfHostIpAddress": "127.0.0.1" + }, + "configParams": {"name1":"value1", "name2":"value2"} +} +} |