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%2FDoDeleteVnfAndModules.groovy;h=5d1e2a2eaebed225b7eb834d4ba5d43dd64ab779;hb=73416d2bebe39643e30c91d0ce5a6f4d3f91ce62;hp=3b23a035891ea711b0945f04763e525ddaa39fdd;hpb=c6c5958e9827e9ba5f4df8ca5862c3770116813d;p=so.git diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 3b23a03589..5d1e2a2eae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.logger.LoggingAnchor import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.camunda.bpm.engine.delegate.BpmnError @@ -40,12 +41,14 @@ import org.onap.so.bpmn.core.domain.ModuleResource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.AAIObjectType +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -60,7 +63,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() /** * This method gets and validates the incoming @@ -110,8 +113,8 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { 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("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); + 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) @@ -238,9 +241,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest ") @@ -262,7 +265,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { try { def vnfId = execution.getVariable('vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) try { Optional genericVnfOp = getAAIClient().get(GenericVnf.class,uri) @@ -322,7 +325,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } if (vfModuleBaseEntry != null) { vfModulesList.add(vfModuleBaseEntry) - } + } } }else{ execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', 404) @@ -331,17 +334,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } execution.setVariable("DDVAM_vfModules", vfModulesList) } 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(), - 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + 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 queryAAIVfModule(): ' + e.getMessage()) } } @@ -367,9 +369,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) }catch(Exception e){ - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareNextModuleToDelete ") @@ -393,9 +395,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") @@ -501,7 +503,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("workflowException: " + workflowException) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) logger.debug("SDNCResponse: " + response)