X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-infrastructure-common%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fscripts%2FDoCreateVfModule.groovy;h=6b4fc840f7a3aeffd5c9a9b8bb682c17aedff5d1;hb=1f8531ddb54b133ed0b25628d43ec698caa9b087;hp=80bc201ecd3020e35ffd004c98ef4e215d0519aa;hpb=ff8c5e9f78b46f29c08576393438e902ea6d8cd6;p=so.git diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 80bc201ecd..6b4fc840f7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -62,7 +63,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -84,7 +84,7 @@ public class DoCreateVfModule extends VfModuleBase { String Prefix="DCVFM_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() OofInfraUtils oofInfraUtils = new OofInfraUtils() CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() @@ -569,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -598,7 +598,7 @@ public class DoCreateVfModule extends VfModuleBase { */ public void validateWorkflowResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) } @@ -622,7 +622,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error') } @@ -668,8 +668,7 @@ public class DoCreateVfModule extends VfModuleBase { rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true") execution.setVariable("rollbackData", rollbackData) } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage()) + logger.debug('Exception occurred while postProcessing CreateAAIVfModule request: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage()) } logger.trace('Exited ' + method) @@ -741,8 +740,7 @@ public class DoCreateVfModule extends VfModuleBase { } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) @@ -751,7 +749,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -822,17 +820,16 @@ public class DoCreateVfModule extends VfModuleBase { } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + 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("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } @@ -868,7 +865,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest") @@ -962,7 +959,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCGetRequest Process") @@ -982,6 +979,8 @@ public class DoCreateVfModule extends VfModuleBase { //Get variables //cloudSiteId def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + //cloudOwner + def cloudOwner = execution.getVariable("DCVFM_cloudOwner") //tenantId def tenantId = execution.getVariable("DCVFM_tenantId") //vnfType @@ -1070,6 +1069,7 @@ public class DoCreateVfModule extends VfModuleBase { String createVnfARequest = """ ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(cloudOwner)} ${MsoUtils.xmlEscape(tenantId)} ${MsoUtils.xmlEscape(vnfId)} ${MsoUtils.xmlEscape(vnfName)} @@ -1167,7 +1167,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } @@ -1233,6 +1233,7 @@ public class DoCreateVfModule extends VfModuleBase { def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") def vnfId = execution.getVariable("DCVFM_vnfId") def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + def cloudOwner = execution.getVariable("DCVFM_cloudOwner") def sdncVersion = execution.getVariable("DCVFM_sdncVersion") def serviceModelInfo = execution.getVariable("serviceModelInfo") def vnfModelInfo = execution.getVariable("vnfModelInfo") @@ -1557,7 +1558,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch") @@ -1587,7 +1588,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus") @@ -1617,7 +1618,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup") @@ -1634,7 +1635,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("workflowException: " + workflowException) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) String sdncResponse = response @@ -1697,7 +1698,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCGetRequest Process") @@ -1819,14 +1820,14 @@ public class DoCreateVfModule extends VfModuleBase { } catch(BpmnError b){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); throw b }catch (Exception ex) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed " + errorMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") } } @@ -1889,7 +1890,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest") @@ -2022,7 +2023,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered in " + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } @@ -2067,7 +2068,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -2120,7 +2121,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in queryCatalogDB', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) } }