diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-03-25 16:04:41 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-03-26 11:44:39 -0400 |
commit | cd4e5b408603a13dabc58f832e4aae4194e81995 (patch) | |
tree | a53701a308644c0469b5242f7f8370766bd5a453 /bpmn | |
parent | f5420060c758308df18a0e316d6ae214ef9eb5c6 (diff) |
convert openstack to external tasks
Use external tasks to communicate with openstack adapter
Will be more resilient to failures
Refactored all flows to use external tasks not REST calls
Rollback is now an external task
Ensured backwards compatibility
Issue-ID: SO-2767
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I8afdb89c688d756aed0f25f7d9a7fb898142554d
Diffstat (limited to 'bpmn')
27 files changed, 2185 insertions, 1871 deletions
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/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/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/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/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/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-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/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/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-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/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/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", |