From 0bb644bd5c11ce03b6dec71d26127fbd3519a9b4 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 7 Aug 2018 16:06:09 -0400 Subject: Refactored references to AaiUtils to use AAIResourceClient updated bpmn, removed Generic AAI flows, and removed dead useless code Did not modify E2E Delete Service Instance flow as it has changed significantly Issue-ID: SO-813 Change-Id: I1a6bc5353ef89e2ce4359be2654395f7ce060aba Signed-off-by: Benjamin, Max (mb388a) --- .../DoCompareModelofE2EServiceInstance.groovy | 169 ++++-------- .../scripts/DoCreateE2EServiceInstance.groovy | 96 ++++--- .../scripts/DoCreateNetworkInstance.groovy | 300 ++++++++++++--------- .../scripts/DoCreateServiceInstance.groovy | 150 ++++------- .../scripts/DoCreateVfModuleVolumeV2.groovy | 118 ++++---- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 27 ++ .../DoCustomDeleteE2EServiceInstanceV2.groovy | 91 ++----- .../scripts/DoDeleteServiceInstance.groovy | 198 ++++---------- .../scripts/DoUpdateE2EServiceInstance.groovy | 139 ++++------ .../DoUpdateE2EServiceInstanceRollback.groovy | 87 ++---- .../scripts/DoUpdateNetworkInstance.groovy | 170 +++++++----- .../scripts/UpdateCustomE2EServiceInstance.groovy | 229 +++++----------- .../vcpe/scripts/DeleteVcpeResCustService.groovy | 216 +++++++-------- .../scripts/DoCreateAllottedResourceBRG.groovy | 95 ++++++- .../process/DeleteVcpeResCustService.bpmn | 45 +--- .../process/UpdateCustomE2EServiceInstance.bpmn | 60 ++--- .../DoCompareModelofE2EServiceInstance.bpmn | 78 ++---- .../subprocess/DoCreateAllottedResourceBRG.bpmn | 223 ++++----------- .../subprocess/DoCreateAllottedResourceTXC.bpmn | 244 ++++------------- .../subprocess/DoCreateE2ENetworkInstance.bpmn | 41 +-- .../subprocess/DoCreateE2EServiceInstance.bpmn | 58 +--- .../subprocess/DoCreateE2EServiceInstanceV2.bpmn | 54 +--- .../subprocess/DoCreateNetworkInstance.bpmn | 78 ++---- .../subprocess/DoCreateServiceInstance.bpmn | 144 +--------- .../subprocess/DoCreateVfModuleVolumeV2.bpmn | 40 +-- .../src/main/resources/subprocess/DoCreateVnf.bpmn | 116 ++------ .../DoCustomDeleteE2EServiceInstance.bpmn | 54 +--- .../DoCustomDeleteE2EServiceInstanceV2.bpmn | 47 +--- .../subprocess/DoDeleteServiceInstance.bpmn | 34 +-- .../subprocess/DoUpdateE2EServiceInstance.bpmn | 74 +---- .../DoUpdateE2EServiceInstanceRollback.bpmn | 70 +---- .../subprocess/DoUpdateNetworkInstance.bpmn | 78 ++---- 32 files changed, 1212 insertions(+), 2411 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index eceba5abe3..3702862a04 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,47 +20,29 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceInstance +import javax.ws.rs.NotFoundException + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.Resource -import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.domain.ResourceModelInfo import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.common.scripts.AaiUtil -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import groovy.json.* -import java.util.List -import java.util.Map -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource /** * This groovy class supports the DoCompareModelofE2EServiceInstance.bpmn process. * @@ -80,7 +62,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce String Prefix="DCMPMDSI_" private static final String DebugFlag = "isDebugEnabled" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -94,11 +76,11 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce execution.setVariable("prefix", Prefix) //Inputs - + //subscriberInfo. for AAI GET String globalSubscriberId = execution.getVariable("globalSubscriberId") utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - + String serviceType = execution.getVariable("serviceType") utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) @@ -142,85 +124,48 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" + /** + * Gets the service instance from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) - - def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) + execution.setVariable("model-version-id-original", si.getModelVersionId()) + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + }catch(NotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service-instance does not exist AAI") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") } public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - + List addResourceList = execution.getVariable("addResourceList") List delResourceList = execution.getVariable("delResourceList") - + CompareModelsResult cmpResult = new CompareModelsResult() List addedResourceList = new ArrayList() List deletedResourceList = new ArrayList() - - + + String serviceModelUuid = execution.getVariable("model-version-id-target") List requestInputs = new ArrayList() ModelInfo mi = null; @@ -233,11 +178,11 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce rmodel.setResourceUuid(mi.getModelUuid()) rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) addedResourceList.add(rmodel) - + Map resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) - requestInputs.addAll(resourceParameters.keySet()) + requestInputs.addAll(resourceParameters.keySet()) } - + for(Resource rc : delResourceList) { mi = rc.getModelInfo() String resourceCustomizationUuid = mi.getModelCustomizationUuid() @@ -246,15 +191,15 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) rmodel.setResourceUuid(mi.getModelUuid()) rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) - deletedResourceList.add(rmodel) + deletedResourceList.add(rmodel) } - + cmpResult.setAddedResourceList(addedResourceList) cmpResult.setDeletedResourceList(deletedResourceList) - cmpResult.setRequestInputs(requestInputs) + cmpResult.setRequestInputs(requestInputs) execution.setVariable("compareModelsResult", cmpResult) } - + } - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index bb48671e73..b5d196181b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -3,14 +3,14 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,9 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.NotFoundException + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils; @@ -35,6 +38,11 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; @@ -58,7 +66,7 @@ import groovy.json.* * @param - failExists - TODO * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 + * @param - serviceDecomposition - Decomposition for R1710 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) * * Outputs: @@ -98,17 +106,17 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(serviceType)) { msg = "Input serviceType is null" msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (productFamilyId == null) { execution.setVariable("productFamilyId", "") } - + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" @@ -118,8 +126,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) - //requestDetails.modelInfo.for AAI PUT servieInstanceData - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") String serviceInstanceId = execution.getVariable("serviceInstanceId") String uuiRequest = execution.getVariable("uuiRequest") @@ -130,7 +138,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { //aai serviceType and Role can be setted as fixed value now. String aaiServiceType = "E2E Service" String aaiServiceRole = "E2E Service" - + execution.setVariable("modelInvariantUuid", modelInvariantUuid) execution.setVariable("modelUuid", modelUuid) @@ -142,7 +150,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } String statusLine = isBlank(oStatus) ? "" : "${MsoUtils.xmlEscape(oStatus)}" - + AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -155,7 +163,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { ${statusLine} ${MsoUtils.xmlEscape(modelInvariantUuid)} ${MsoUtils.xmlEscape(modelUuid)} - """.trim() + """.trim() execution.setVariable("serviceInstanceData", serviceInstanceData) msoLogger.debug(serviceInstanceData) msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) @@ -170,7 +178,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit preProcessRequest ") } - + public void prepareDecomposeService(DelegateExecution execution) { try { msoLogger.trace("Inside prepareDecomposeService of create generic e2e service ") @@ -193,7 +201,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } public void processDecomposition(DelegateExecution execution) { - msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") + msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") } catch (Exception ex) { @@ -202,23 +210,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } - + public void doServicePreOperation(DelegateExecution execution){ - //we need a service plugin platform here. + //we need a service plugin platform here. ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") + String uuiRequest = execution.getVariable("uuiRequest") String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) + execution.setVariable("uuiRequest", newUuiRequest) } - + public void doServiceHoming(DelegateExecution execution) { - //we need a service plugin platform here. + //we need a service plugin platform here. ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") + String uuiRequest = execution.getVariable("uuiRequest") String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) + execution.setVariable("uuiRequest", newUuiRequest) } - + public void postProcessAAIGET(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET ") String msg = "" @@ -260,6 +268,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit postProcessAAIGET ") } + //TODO use create if not exist public void postProcessAAIPUT(DelegateExecution execution) { msoLogger.trace("postProcessAAIPUT ") String msg = "" @@ -296,7 +305,32 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit postProcessAAIPUT ") } - + + /** + * Gets the service instance and its relationships from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('subscriptionServiceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) + + }catch(BpmnError e) { + throw e; + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void postProcessAAIGET2(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET2 ") String msg = "" @@ -342,7 +376,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRollback (DelegateExecution execution) { msoLogger.trace("preProcessRollback ") try { - + Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { @@ -397,10 +431,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("operationType", operationType) ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List resourceList = serviceDecomposition.getServiceResources() - + for(Resource resource : resourceList){ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" - } + } def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) @@ -429,23 +463,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") } // prepare input param for using DoCreateResources.bpmn public void preProcessForAddResource(DelegateExecution execution) { msoLogger.trace("STARTED preProcessForAddResource Process ") - + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List addResourceList = serviceDecomposition.getServiceResources() execution.setVariable("addResourceList", addResourceList) - + msoLogger.trace("COMPLETED preProcessForAddResource Process ") } public void postProcessForAddResource(DelegateExecution execution) { // do nothing now - + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 4bbaef8ecb..a376e581fe 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -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. @@ -36,6 +36,14 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse; import org.springframework.web.util.UriUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException import groovy.json.* import groovy.xml.XmlUtil @@ -47,7 +55,7 @@ import groovy.xml.XmlUtil */ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstance.class); - + String Prefix="CRENWKI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -56,7 +64,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() def className = getClass().getSimpleName() - + /** * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. * @param execution @@ -78,7 +86,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkOutputs", "") execution.setVariable(Prefix + "networkId","") execution.setVariable(Prefix + "networkName","") - + // AAI query Name execution.setVariable(Prefix + "queryNameAAIRequest","") execution.setVariable(Prefix + "queryNameAAIResponse", "") @@ -149,7 +157,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { //execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") execution.setVariable(Prefix + "isSdncRollbackNeeded", false) execution.setVariable(Prefix + "sdncResponseSuccess", false) - + execution.setVariable(Prefix + "activateSDNCRequest", "") execution.setVariable(Prefix + "activateSDNCResponse", "") execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") @@ -164,7 +172,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "Success", false) execution.setVariable(Prefix + "isException", false) - + } // ************************************************** @@ -175,25 +183,25 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { * @param execution */ public void preProcessRequest (DelegateExecution execution) { - - execution.setVariable("prefix",Prefix) + + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") - + try { // initialize flow variables InitializeProcessVariables(execution) - + // GET Incoming request & validate 3 kinds of format. execution.setVariable("action", "CREATE") String networkRequest = execution.getVariable("bpmnRequest") if (networkRequest != null) { if (networkRequest.contains("requestDetails")) { - // JSON format request is sent, create xml + // JSON format request is sent, create xml try { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - + } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() msoLogger.debug(dataErrorMessage) @@ -201,26 +209,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } else { // XML format request is sent - + } } else { // vIPR format request is sent, create xml from individual variables networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) } - + networkRequest = utils.formatXml(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) msoLogger.debug(Prefix + "networkRequest - " + '\n' + networkRequest) - + // validate 'backout-on-failure' to override 'mso.rollback' boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) - + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) - + // prepare messageId String messageId = execution.getVariable("testMessageId") // for testing if (messageId == null || messageId == "") { @@ -230,12 +238,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) - + String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) msoLogger.debug(Prefix + "source - " + source) - - // validate cloud region + + // validate cloud region String lcpCloudRegionId = utils.getNodeText(networkRequest, "aic-cloud-region") if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." @@ -244,7 +252,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } // validate service instance id - String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") + String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." msoLogger.debug(" Invalid Request - " + dataErrorMessage) @@ -253,12 +261,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) - + try { def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey",execution)) execution.setVariable("BasicAuthHeaderValuePO",encodedString) execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - + } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() @@ -273,11 +281,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("GENGS_type", "service-instance") msoLogger.debug("GENGS_type - " + "service-instance") msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) - + String sdncVersion = execution.getVariable("sdncVersion") msoLogger.debug("sdncVersion? : " + sdncVersion) - - // build 'networkOutputs' + + // build 'networkOutputs' String networkId = utils.getNodeText(networkRequest, "network-id") if ((networkId == null) || (networkId == "null")) { networkId = "" @@ -295,25 +303,49 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) - + } catch (BpmnError e) { throw e; - + } catch (Exception ex) { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - + } } - + + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('CRENWKI_serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(!resourceClient.exists(uri)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void callRESTQueryAAINetworkName (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " ) // get variables @@ -348,7 +380,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase()) execution.setVariable("orchestrationStatus", orchestrationStatus) - + } catch (Exception ex) { // response is empty execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) @@ -385,9 +417,9 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAICloudRegion (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " ) try { @@ -434,7 +466,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkId(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) @@ -445,15 +477,15 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") if (execution.getVariable("sdncVersion") != "1610") { String networkResponseInformation = "" - try { + try { networkResponseInformation = utils.getNodeXml(assignSDNCResponse, "network-response-information", false).replace("tag0:","").replace(":tag0","") networkId = utils.getNodeText(networkResponseInformation, "instance-id") } catch (Exception ex) { String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty " msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - + } + } else { networkId = utils.getNodeText(assignSDNCResponse, "network-id") } @@ -465,11 +497,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId) } - + execution.setVariable(Prefix + "networkId", networkId) String networkName = utils.getNodeText(assignSDNCResponse, "network-name") execution.setVariable(Prefix + "networkName", networkName) - + networkId = UriUtils.encode(networkId,"UTF-8") // Prepare AA&I url @@ -491,7 +523,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (returnCode=='200') { execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) msoLogger.debug(" QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) - + String netId = utils.getNodeText(aaiResponseAsString, "network-id") execution.setVariable(Prefix + "networkId", netId) String netName = utils.getNodeText(aaiResponseAsString, "network-name") @@ -532,7 +564,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTReQueryAAINetworkId(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) @@ -540,7 +572,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { try { // get variables String networkId = execution.getVariable(Prefix + "networkId") - String netId = networkId + String netId = networkId networkId = UriUtils.encode(networkId,"UTF-8") // Prepare AA&I url @@ -606,7 +638,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " ) @@ -748,7 +780,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " ) @@ -882,7 +914,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " ) @@ -1017,7 +1049,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) @@ -1046,7 +1078,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" 'payload' to Update Contrail - " + "\n" + payloadXml) APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payloadXml) - + String returnCode = response.getStatusCode() execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) @@ -1060,7 +1092,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "isPONR", false) } else { execution.setVariable(Prefix + "isPONR", true) - } + } msoLogger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR")) } else { if (returnCode=='404') { @@ -1096,7 +1128,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareCreateNetworkRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance") @@ -1106,7 +1138,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // get variables String requestId = execution.getVariable("msoRequestId") if (requestId == null) { - requestId = execution.getVariable("mso-request-id") + requestId = execution.getVariable("mso-request-id") } String messageId = execution.getVariable(Prefix + "messageId") String source = execution.getVariable(Prefix + "source") @@ -1115,7 +1147,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - + // Prepare Network request String routeCollection = execution.getVariable(Prefix + "routeCollection") String policyCollection = execution.getVariable(Prefix + "networkCollection") @@ -1138,7 +1170,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareSDNCRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance") @@ -1158,9 +1190,9 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("mso-request-id", requestId) } else { requestId = execution.getVariable("mso-request-id") - } + } execution.setVariable(Prefix + "requestId", requestId) - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) @@ -1179,21 +1211,21 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareRpcSDNCRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance") try { // get variables - + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) String createNetworkInput = execution.getVariable(Prefix + "networkRequest") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") String networkId = execution.getVariable(Prefix + "networkId") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) @@ -1209,11 +1241,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRpcSDNCActivateRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance") try { @@ -1223,7 +1255,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") String networkId = execution.getVariable(Prefix + "networkId") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) @@ -1240,7 +1272,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + @@ -1249,7 +1281,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // ************************************************** public void validateCreateNetworkResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance") @@ -1321,7 +1353,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void validateSDNCResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance") @@ -1329,7 +1361,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String response = execution.getVariable(Prefix + "assignSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") WorkflowException workflowException = execution.getVariable("WorkflowException") - + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) // reset variable @@ -1349,7 +1381,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void validateRpcSDNCActivateResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance") @@ -1373,12 +1405,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response") throw new BpmnError("MSOWorkflowException") } - + } public void prepareSDNCRollbackRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance") @@ -1392,7 +1424,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String networkId = execution.getVariable(Prefix + "networkId") if (networkId == 'null') {networkId = ""} String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) @@ -1410,7 +1442,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareRpcSDNCRollbackRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance") @@ -1440,15 +1472,15 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRpcSDNCActivateRollback(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance") try { - + // get variables String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) String createNetworkInput = execution.getVariable(Prefix + "networkRequest") @@ -1473,76 +1505,76 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRollbackData(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance") - + try { - + Map rollbackData = new HashMap(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != null) { if (rollbackSDNCRequest != "") { rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) } - } + } String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { + if (rollbackNetworkRequest != "") { rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } + } } String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") if (rollbackActivateSDNCRequest != null) { - if (rollbackActivateSDNCRequest != "") { + if (rollbackActivateSDNCRequest != "") { rollbackData.put("rollbackActivateSDNCRequest", execution.getVariable(Prefix + "rollbackActivateSDNCRequest")) - } + } } execution.setVariable("rollbackData", rollbackData) msoLogger.debug("** rollbackData : " + rollbackData) - + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void postProcessResponse(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside postProcessResponse() of DoCreateNetworkInstance") - + try { - + //Conditions: - // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" + // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" // 2. Success: execution.getVariable("WorkflowException") == null (NULL) - // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) - + // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) + msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) // successful flow - if (execution.getVariable(Prefix + "isException") == false) { + if (execution.getVariable(Prefix + "isException") == false) { // set rollback data execution.setVariable("orchestrationStatus", "") execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) - prepareSuccessRollbackData(execution) // populate rollbackData + prepareSuccessRollbackData(execution) // populate rollbackData execution.setVariable("WorkflowException", null) execution.setVariable(Prefix + "Success", true) msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") } else { // inside sub-flow logic - execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. @@ -1553,45 +1585,45 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "WorkflowException") != null) { WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") exceptionMessage = pwfex.getErrorMessage() - } + } } // going to the Main flow: a-la-carte or macro msoLogger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } - + } catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") - + } - - - + + + } - + public void prepareSuccessRollbackData(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance") - + try { - + if (execution.getVariable("sdncVersion") != '1610') { prepareRpcSDNCRollbackRequest(execution) prepareRpcSDNCActivateRollback(execution) } else { prepareSDNCRollbackRequest(execution) - } - + } + Map rollbackData = new HashMap(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1612,63 +1644,63 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } public void setExceptionFlag(DelegateExecution execution){ - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance") - + try { - + execution.setVariable(Prefix + "isException", true) - + if (execution.getVariable("SavedWorkflowException1") != null) { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) - + } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - } - + } + } - - + + // ******************************* // Build Error Section // ******************************* - + public void processJavaException(DelegateExecution execution){ - + execution.setVariable("prefix",Prefix) - + try{ msoLogger.debug( "Caught a Java Exception in " + Prefix) msoLogger.debug("Started processJavaException Method") msoLogger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - + }catch(Exception e){ msoLogger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 93a260a544..b44940eb20 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -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. @@ -62,7 +62,7 @@ import groovy.json.* * @param - failExists - TODO * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 + * @param - serviceDecomposition - Decomposition for R1710 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) * * Outputs: @@ -71,7 +71,7 @@ import groovy.json.* * @param - WorkflowException * @param - serviceInstanceName - (GET from AAI if null in input) * - * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) + * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) */ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { @@ -89,7 +89,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String requestId = execution.getVariable("msoRequestId") execution.setVariable("prefix", Prefix) - + setBasicDBAuthHeader(execution, isDebugEnabled) //Inputs //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology @@ -106,17 +106,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (productFamilyId == null) { execution.setVariable("productFamilyId", "") } - + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" @@ -131,19 +131,19 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String modelVersion = "" String modelUuid = "" String modelName = "" - String serviceInstanceName = "" + String serviceInstanceName = "" //Generated in parent.for AAI PUT String serviceInstanceId = "" String serviceType = "" String serviceRole = "" - + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") if (serviceDecomp != null) { serviceType = serviceDecomp.getServiceType() ?: "" msoLogger.debug("serviceType:" + serviceType) serviceRole = serviceDecomp.getServiceRole() ?: "" - + ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() if (serviceInstance != null) { @@ -152,7 +152,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceInstanceId) execution.setVariable("serviceInstanceName", serviceInstanceName) } - + ModelInfo modelInfo = serviceDecomp.getModelInfo() if (modelInfo != null) { @@ -161,7 +161,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { modelUuid = modelInfo.getModelUuid() ?: "" modelName = modelInfo.getModelName() ?: "" } - else + else { msg = "Input serviceModelInfo is null" msoLogger.debug(msg) @@ -173,21 +173,21 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" - + String serviceModelInfo = execution.getVariable("serviceModelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + } modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" //modelCustomizationUuid NA for SI - + } - + execution.setVariable("serviceType", serviceType) execution.setVariable("serviceRole", serviceRole) execution.setVariable("serviceInstanceName", serviceInstanceName) @@ -196,7 +196,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("modelVersion", modelVersion) execution.setVariable("modelUuid", modelUuid) execution.setVariable("modelName", modelName) - + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) @@ -208,13 +208,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { break; } } - + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW //Alacartes are sent to SDNC if they are listed in config variable above execution.setVariable("sendToSDNC", true) if(execution.getVariable("sdncVersion").equals("1610")) //alacarte { - if(!isSdncService){ + if(!isSdncService){ execution.setVariable("sendToSDNC", false) //alacarte non-sdnc svcs must provide name (sdnc provides name for rest) if (isBlank(execution.getVariable("serviceInstanceName" ))) @@ -225,25 +225,25 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } } } - + msoLogger.debug("isSdncService: " + isSdncService) msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) - + //macro may provide name and alacarte-portm may provide name execution.setVariable("checkAAI", false) if (!isBlank(execution.getVariable("serviceInstanceName" ))) { execution.setVariable("checkAAI", true) } - + if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - - + + StringBuilder sbParams = new StringBuilder() Map paramsMap = execution.getVariable("serviceInputParams") if (paramsMap != null) @@ -278,16 +278,16 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String statusLine = isBlank(oStatus) ? "" : "${MsoUtils.xmlEscape(oStatus)}" String serviceTypeLine = isBlank(serviceType) ? "" : "${MsoUtils.xmlEscape(serviceType)}" String serviceRoleLine = isBlank(serviceRole) ? "" : "${MsoUtils.xmlEscape(serviceRole)}" - + //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT String environmentContext = "" String workloadContext ="" - + try{ String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - + msoLogger.debug("JSON IS: "+json) - + environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" msoLogger.debug("Env Context is: "+ environmentContext) @@ -299,7 +299,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - + //Create AAI Payload AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) @@ -318,7 +318,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceData", serviceInstanceData) msoLogger.debug(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData) - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -329,7 +329,6 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit preProcessRequest") } - //TODO: Will be able to replace with call to GenericGetService public void getAAICustomerById (DelegateExecution execution) { // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -400,47 +399,6 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("postProcessAAIGET") - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceName) - WorkflowException workflowException = execution.getVariable("WorkflowException") - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - msoLogger.debug("Found Service-instance in AAI") - msg = "ServiceInstance already exists in AAI:" + serviceInstanceName - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit postProcessAAIGET") - } - public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("postProcessAAIPUT") @@ -498,17 +456,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def modelVersion = execution.getVariable("modelVersion") def modelUuid = execution.getVariable("modelUuid") def modelName = execution.getVariable("modelName") - + def sdncRequestId = UUID.randomUUID().toString() - + def siParamsXml = execution.getVariable("siParamsXml") - + // special URL for SDNW, msoAction helps set diff url in SDNCA if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) { msoAction = "TRANSPORT" } - + String sdncAssignRequest = """ paramsMap = execution.getVariable("vfModuleInputParams") @@ -396,17 +408,17 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { if(failIfExists == null) { failIfExists = 'true' } - + String messageId = UUID.randomUUID() msoLogger.debug("messageId to be used is generated: " + messageId) - + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) } msoLogger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl) - + // build request String vnfSubCreateWorkflowRequest = """ @@ -465,9 +477,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) } - + public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { - + def request = """ @@ -485,16 +497,16 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { true ${MsoUtils.xmlEscape(notificationUrl)} - """ - - return request + """ + + return request } public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) { String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId) return newRequest } - + /** * Validate VNF adapter response * @param execution @@ -513,10 +525,10 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") } } - + /** - * Update voulume group in AAI + * Update voulume group in AAI * @TODO: Can we re-use the create method?? * @param execution * @param isDebugEnabled @@ -525,7 +537,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") String volumeGroupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - String modelCustomizationId = execution.getVariable("modelCustomizationId") + String modelCustomizationId = execution.getVariable("modelCustomizationId") String cloudRegion = execution.getVariable("lcpCloudRegionId") AaiUtil aaiUtil = new AaiUtil(this) @@ -538,7 +550,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") - + execution.setVariable(prefix+"heatStackId", heatStackID) NetworkUtils networkUtils = new NetworkUtils() diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 46a502e124..7fa8b4409b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -43,6 +43,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.springframework.web.util.UriUtils +import org.json.JSONObject /** @@ -247,6 +248,32 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { msoLogger.trace("COMPLETED DoCreateVnf PreProcessRequest Process") } + /** + * Gets the service instance from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("GENGS_siResourceLink", uri.build().toString()) + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch(Exception ex) { + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + private Object getVariableEnforced(DelegateExecution execution, String name){ Object enforced = execution.getVariable(name) if(!enforced){ diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 20a7f43de7..21bf0f2c5c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -37,7 +37,14 @@ import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse; import org.springframework.web.util.UriUtils; - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException import groovy.json.* @@ -149,63 +156,32 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce msoLogger.info("Exited " + method) } - - - public void postProcessAAIGET(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - - String msg = "" - + /** + * Gets the service instance and its relationships from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.info("serviceInstanceId: "+serviceInstanceId) - - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - msoLogger.info("foundInAAI: "+foundInAAI) - - String serviceType = "" - - - if(foundInAAI){ - msoLogger.info("Found Service-instance in AAI") + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') - String siData = execution.getVariable("GENGS_service") - msoLogger.info("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + String json = wrapper.getJson() - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } + execution.setVariable("serviceInstance", json) - msoLogger.info("Service-instance NOT found in AAI. Silent Success") - } - }catch (BpmnError e) { + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Bpmn error encountered in " + method + "--" + ex.getMessage() - msoLogger.info(msg) + }catch(NotFoundException e) { + msoLogger.info("SI not found in aai. Silent Success ") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) } private void loadResourcesProperties(DelegateExecution execution) { @@ -334,23 +310,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String serviceInstanceId = execution.getVariable("serviceInstanceId") - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } execution.setVariable(Prefix+"resourceList", "") execution.setVariable(Prefix+"resourceCount", 0) execution.setVariable(Prefix+"nextResource", 0) execution.setVariable(Prefix+"resourceFinish", true) - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - msoLogger.info("serviceInstanceAaiRecord: " +serviceInstanceAaiRecord) - - String aaiJsonRecord = jsonUtil.xml2json(serviceInstanceAaiRecord) + String aaiJsonRecord = execution.getVariable("serviceInstance"); + msoLogger.info("serviceInstanceAaiRecord: " +aaiJsonRecord) msoLogger.info("aaiJsonRecord: " +aaiJsonRecord) def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 198144ad34..c7e3eb437c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -22,12 +22,10 @@ package org.onap.so.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.*; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -35,17 +33,13 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger -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.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource import groovy.json.* @@ -282,170 +276,86 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit postProcessSDNC " + method + " ") } - public void postProcessAAIGET(DelegateExecution execution) { - - msoLogger.trace("postProcessAAIGET ") - String msg = "" - + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI == true){ - msoLogger.debug("Found Service-instance in AAI") - - //Extract GlobalSubscriberId - String siRelatedLink = execution.getVariable("GENGS_siResourceLink") - if (isBlank(siRelatedLink)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("GENGS_siResourceLink", uri.build().toString()) + Map keys = uri.getURIKeys() + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if(isBlank(globalSubscriberId)){ + globalSubscriberId = keys.get("global-customer-id") + execution.setVariable("globalSubscriberId", globalSubscriberId) } - else - { - msoLogger.debug("Found Service-instance in AAI. link: " + siRelatedLink) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if(isBlank(globalSubscriberId)){ - int custStart = siRelatedLink.indexOf("customer/") - int custEnd = siRelatedLink.indexOf("/service-subscriptions") - globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd) - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //Extract Service Type if not provided on request - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - if(isBlank(subscriptionServiceType)){ - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) - subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) - { - msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + //Extract Service Type if not provided on request + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if(isBlank(subscriptionServiceType)){ + String serviceTypeEncoded = keys.get("service-type") //TODO will this produce as already decoded? + subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) } - String siData = execution.getVariable("GENGS_service") - msoLogger.debug("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - msoLogger.debug("SI Data" + siData) - serviceType = utils.getNodeText(siData,"service-type") + AAIResultWrapper wrapper = resourceClient.get(uri) + List uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) + uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) + uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK)) + + if(uriList.isEmpty){ + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + String orchestrationStatus = si.getOrchestrationStatus() + String serviceType = si.getServiceType() execution.setVariable("serviceType", serviceType) - execution.setVariable("serviceRole", utils.getNodeText(siData,"service-role")) - String orchestrationStatus = utils.getNodeText(siData,"orchestration-status") - - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - msoLogger.debug("SI Data relationship-list exists:") - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){ - msoLogger.debug("ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources") - execution.setVariable("siInUse", true) - //there are relationship dependencies to this Service Instance - msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - }else{ - msoLogger.debug("Relationship NOT related to OpenStack") - } - } - } - } + execution.setVariable("serviceRole", si.getServiceRole()) - if ("TRANSPORT".equalsIgnoreCase(serviceType)) - { - if ("PendingDelete".equals(orchestrationStatus)) - { + if("TRANSPORT".equalsIgnoreCase(serviceType)){ + if("PendingDelete".equals(orchestrationStatus)){ execution.setVariable("skipDeactivate", true) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status: " + orchestrationStatus) } - else - { - msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } - //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" - msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); boolean isSdncService= false - for (String listEntry : svcList){ - if (listEntry.equalsIgnoreCase(serviceType)){ + for(String listEntry : svcList){ + if(listEntry.equalsIgnoreCase(serviceType)){ isSdncService = true break; } } - - //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW - //Alacartes are sent to SDNC if they are listed in config variable above execution.setVariable("sendToSDNC", true) - if(execution.getVariable("sdncVersion").equals("1610")) //alacarte - { + if(execution.getVariable("sdncVersion").equals("1610")){ if(!isSdncService){ execution.setVariable("sendToSDNC", false) } } - msoLogger.debug("isSdncService: " + isSdncService) - msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) - msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) - + }else{ + execution.setVariable("siInUse", true) + msoLogger.debug("Stopped deleting Service Instance, it has dependencies") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies") } }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ - msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - msoLogger.debug("Service-instance NOT found in AAI. Silent Success") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance not found in aai") } - } catch (BpmnError e) { + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteServiceInstance.postProcessAAIGET. " + ex.getMessage() + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") } /** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 5fb6a9df9a..cb50fbbee6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -53,7 +53,7 @@ import groovy.json.* * @param - serviceDecomposition_Original * @param - addResourceList * @param - delResourceList - * + * * Outputs: * @param - rollbackData (localRB->null) * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) @@ -63,15 +63,15 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DUPDSI_" private static final String DebugFlag = "isDebugEnabled" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled) - - String msg = "" + + String msg = "" try { execution.setVariable("prefix", Prefix) @@ -79,11 +79,11 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { //for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - + //for AAI PUT & SDNC assignTopology String serviceType = execution.getVariable("serviceType") utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) - + //for SDNC assignTopology String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId @@ -92,14 +92,14 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(serviceType)) { msg = "Input serviceType is null" utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - - //Generated in parent for AAI + + //Generated in parent for AAI String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" @@ -108,21 +108,21 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { } String serviceInstanceName = execution.getVariable("serviceInstanceName") - + // user params String uuiRequest = execution.getVariable("uuiRequest") - + // target model Invariant uuid String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) - + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + // target model uuid String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") execution.setVariable("modelUuid", modelUuid) - + utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -130,10 +130,10 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) + utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) } - + public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -161,7 +161,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { for(Resource resource : resourceList){ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) @@ -189,34 +189,34 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } - + public void preProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "create") - + execution.setVariable("hasResourcetoAdd", false) List addResourceList = execution.getVariable("addResourceList") if(addResourceList != null && !addResourceList.isEmpty()) { - execution.setVariable("hasResourcetoAdd", true) + execution.setVariable("hasResourcetoAdd", true) } - + utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled) } public void postProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "update") utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) } - + public void preProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) @@ -232,7 +232,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { if(hasResourcetoDelete) { def jsonSlurper = new JsonSlurper() - String serviceRelationShip = execution.getVariable("serviceRelationShip") + String serviceRelationShip = execution.getVariable("serviceRelationShip") List relationShipList = jsonSlurper.parseText(serviceRelationShip) //Set the real resource instance id to the decomosed resource list @@ -249,7 +249,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { } } } - + execution.setVariable("deleteResourceList", delResourceList) utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) @@ -258,60 +258,13 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { public void postProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "update") utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled) - } - - public void preProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion", utils.getNodeText(aaiService, "resource-version")) - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoUpdateE2EServiceInstance.postProcessAAIGET " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } + } - public void preProcessAAIPUT(DelegateExecution execution) { + public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -321,7 +274,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion") //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - + //requestDetails.modelInfo.for AAI PUT servieInstanceData //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") @@ -334,7 +287,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { AaiUtil aaiUriUtil = new AaiUtil(this) - utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) + utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -349,7 +302,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { ${MsoUtils.xmlEscape(aaiServiceRole)} ${MsoUtils.xmlEscape(serviceInstanceVersion)} ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelUuid)} """.trim() execution.setVariable("serviceInstanceData", serviceInstanceData) @@ -357,10 +310,10 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.logAudit(serviceInstanceData) utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - + utils.log("INFO", "Exited " + method, isDebugEnabled) - } - + } + public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) @@ -397,13 +350,13 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } + } public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) try { - + Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { @@ -441,11 +394,11 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) } - + public void postConfigRequest(execution){ //now do noting } - + } - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index a2d94baaed..b5a8c898a1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -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. @@ -67,13 +67,13 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce execution.setVariable("rollbackAAI",false) execution.setVariable("rollbackAdded",false) execution.setVariable("rollbackDeleted",false) - + List addResourceList = execution.getVariable("addResourceList") List delResourceList = execution.getVariable("delResourceList") execution.setVariable("addResourceList_o", addResourceList) execution.setVariable("delResourceList_o", delResourceList) //exchange add and delete resource list - execution.setVariable("addResourceList", delResourceList) + execution.setVariable("addResourceList", delResourceList) execution.setVariable("delResourceList", addResourceList) try { @@ -103,14 +103,14 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce { execution.setVariable("rollbackAdded", true) } - + def rollbackDeleted = rollbackData.get("SERVICEINSTANCE", "rollbackDeleted") if ("true".equals(rollbackDeleted)) { execution.setVariable("rollbackDeleted", true) - } + } - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true && execution.getVariable("rollbackDeleted") != true) { execution.setVariable("skipRollback", true) @@ -148,7 +148,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce boolean rollbackAAI = execution.getVariable("rollbackAAI") boolean rollbackAdded = execution.getVariable("rollbackAdded") boolean rollbackDeleted = execution.getVariable("rollbackDeleted") - + List addResourceList = execution.getVariable("addResourceList_o") List delResourceList = execution.getVariable("delResourceList_o") execution.setVariable("addResourceList", addResourceList) @@ -177,66 +177,21 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce msoLogger.debug(msg) } } - - + + public void preProcessForAddResource(DelegateExecution execution) { } public void postProcessForAddResource(DelegateExecution execution) { } - + public void preProcessForDeleteResource(DelegateExecution execution) { } public void postProcessForDeleteResource(DelegateExecution execution) { - } - - public void preProcessAAIGET(DelegateExecution execution) { - } - - public void postProcessAAIGET(DelegateExecution execution) { - msoLogger.trace("postProcessAAIGET ") - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion_n", utils.getNodeText(aaiService, "resource-version")) - msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET " + ex.getMessage() - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit postProcessAAIGET ") - } + } - public void preProcessAAIPUT(DelegateExecution execution) { + public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' msoLogger.info("Entered " + method) String msg = "" @@ -244,7 +199,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") // execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - + //requestDetails.modelInfo.for AAI PUT servieInstanceData //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") @@ -255,7 +210,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("model-version-id-original") - //AAI PUT + //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) @@ -271,7 +226,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce ${MsoUtils.xmlEscape(aaiServiceRole)} ${MsoUtils.xmlEscape(serviceInstanceVersion)} ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelUuid)} """.trim() execution.setVariable("serviceInstanceData", serviceInstanceData) @@ -279,10 +234,10 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce msoLogger.debug(serviceInstanceData) msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) msoLogger.info(" 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData) - + msoLogger.info("Exited " + method) - } - + } + public void postProcessAAIPUT(DelegateExecution execution) { msoLogger.trace("postProcessAAIPUT ") String msg = "" @@ -299,7 +254,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce } else { - + } } catch (BpmnError e) { @@ -310,7 +265,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.trace("Exit postProcessAAIPUT ") - } + } public void processRollbackException(DelegateExecution execution){ msoLogger.trace("processRollbackException ") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 7272f421fc..4f6fbf9966 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -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. @@ -37,6 +37,15 @@ import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException + import groovy.json.* import groovy.xml.XmlUtil @@ -46,7 +55,7 @@ import groovy.xml.XmlUtil */ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstance.class); - + String Prefix="UPDNETI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -109,7 +118,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkTableRefUriList", null) execution.setVariable(Prefix + "networkTableRefCount", 0) execution.setVariable(Prefix + "tableRefCollection", "") - + // AAI requery Id execution.setVariable(Prefix + "requeryIdAAIRequest","") execution.setVariable(Prefix + "requeryIdAAIResponse", "") @@ -137,9 +146,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "isVnfBindingPresent", false) execution.setVariable(Prefix + "Success", false) execution.setVariable(Prefix + "serviceInstanceId", "") - + execution.setVariable(Prefix + "isException", false) - + } // ************************************************** @@ -158,7 +167,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { try { // initialize flow variables InitializeProcessVariables(execution) - + // GET Incoming request & validate 3 kinds of format. execution.setVariable("action", "UPDATE") String networkRequest = execution.getVariable("bpmnRequest") @@ -169,7 +178,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - + } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() msoLogger.debug(dataErrorMessage) @@ -177,27 +186,27 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } else { // XML format request is sent - + } } else { // vIPR format request is sent, create xml from individual variables networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) } - + networkRequest = utils.formatXml(networkRequest) msoLogger.debug(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) msoLogger.debug(" network-request - " + '\n' + networkRequest) - + // validate 'disableRollback' (aka, 'suppressRollback') boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) - + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) - + // prepare messageId String messageId = execution.getVariable(Prefix + "messageId") // for testing if (messageId == null || messageId == "") { @@ -207,11 +216,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" UPDNETI_messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) - + String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) msoLogger.debug(Prefix + "source - " + source) - + String networkId = "" if (utils.nodeExists(networkRequest, "network-id")) { networkId = utils.getNodeText(networkRequest, "network-id") @@ -221,10 +230,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String dataErrorMessage = "Variable 'network-id' value/element is missing." msoLogger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - + } } - + String lcpCloudRegion = "" if (utils.nodeExists(networkRequest, "aic-cloud-region")) { lcpCloudRegion = utils.getNodeText(networkRequest, "aic-cloud-region") @@ -235,7 +244,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } - + String serviceInstanceId = "" if (utils.nodeExists(networkRequest, "service-instance-id")) { serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") @@ -246,35 +255,33 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } - + // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) - + try { def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValuePO",encodedString) execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - + } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - + // Set variables for Generic Get Sub Flow use execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) - - execution.setVariable("GENGS_type", "service-instance") - msoLogger.debug("GENGS_type - " + "service-instance") + msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) - + String sdncVersion = execution.getVariable("sdncVersion") msoLogger.debug("sdncVersion? : " + sdncVersion) - - // build 'networkOutputs' + + // build 'networkOutputs' networkId = utils.getNodeText(networkRequest, "network-id") if ((networkId == null) || (networkId == "null")) { networkId = "" @@ -292,7 +299,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) - + } catch (BpmnError e) { throw e; @@ -307,6 +314,31 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } + /** + * Gets the service instance uri from aai + * + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(!resourceClient.exists(uri)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { execution.setVariable("prefix", Prefix) @@ -383,7 +415,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String returnCode = response.getStatusCode() execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) msoLogger.debug(" ***** AAI Response Code : " + returnCode) - + String aaiResponseAsString = response.getResponseBodyAsString() if (returnCode=='200') { @@ -462,12 +494,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String netName = utils.getNodeText(aaiResponseAsString, "network-name") String networkOutputs = """ - ${MsoUtils.xmlEscape(netId)} + ${MsoUtils.xmlEscape(netId)} ${MsoUtils.xmlEscape(netName)} """ execution.setVariable(Prefix + "networkOutputs", networkOutputs) msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) - + } else { if (returnCode=='404') { String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." @@ -866,13 +898,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - + } else { if (aaiResponseAsString.contains("RESTFault")) { WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) execution.setVariable("WorkflowException", exceptionObject) throw new BpmnError("MSOWorkflowException") - + } else { // aai all errors String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode @@ -908,7 +940,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; - + } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() msoLogger.debug(exceptionMessage) @@ -917,7 +949,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { execution.setVariable("prefix", Prefix) @@ -953,7 +985,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payload) String returnCode = response.getStatusCode() String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() - + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) @@ -1015,7 +1047,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - + // Prepare Network request String routeCollection = execution.getVariable(Prefix + "routeCollection") String policyCollection = execution.getVariable(Prefix + "networkCollection") @@ -1057,7 +1089,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if (networkId == null) {networkId = ""} String serviceInstanceId = utils.getNodeText(updateNetworkInput, "service-instance-id") - + String queryAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse") // 1. prepare assign topology via SDNC Adapter SUBFLOW call @@ -1078,7 +1110,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - + // ************************************************** @@ -1212,7 +1244,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "Success", true) msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") } else { - execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. @@ -1223,18 +1255,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "WorkflowException") != null) { WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") exceptionMessage = pwfex.getErrorMessage() - } + } } // going to the Main flow: a-la-carte or macro msoLogger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } - + } catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() @@ -1253,7 +1285,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ") try { - // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. + // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) // get variables String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) @@ -1282,11 +1314,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { public void prepareRollbackData(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ") - + try { - + Map rollbackData = new HashMap(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1302,33 +1334,33 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable("rollbackData", rollbackData) msoLogger.debug("** rollbackData : " + rollbackData) - + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void prepareSuccessRollbackData(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ") - + try { - + if (execution.getVariable("sdncVersion") != '1610') { // skip: 1702 for 'changeassign' or equivalent not yet defined in SNDC, so no rollback. } else { prepareSDNCRollbackRequest(execution) } - + Map rollbackData = new HashMap(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1343,43 +1375,43 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void setExceptionFlag(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ") - + try { - + execution.setVariable(Prefix + "isException", true) - + if (execution.getVariable("SavedWorkflowException1") != null) { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) - + } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } - + } @@ -1396,7 +1428,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - + }catch(Exception e){ msoLogger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 538f882c2b..ac8e506e1f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,25 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.NotFoundException + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.springframework.web.util.UriUtils import groovy.json.* @@ -68,7 +76,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor msg = "Input serviceInstanceId' is null" exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + //subscriberInfo for aai String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") if (isBlank(globalSubscriberId)) { @@ -86,16 +94,16 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - utils.log("INFO", msg, isDebugEnabled) + utils.log("INFO", msg, isDebugEnabled) } else { execution.setVariable("productFamilyId", productFamilyId) } - + //user params - String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") + String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") utils.log("INFO", "userParams:" + userParams, isDebugEnabled) List paramList = jsonUtil.StringArrayToList(execution, userParams) - String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") + String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") if (isBlank(uuiRequest)) { msg = "Input uuiRequest is null" utils.log("INFO", msg, isDebugEnabled) @@ -116,34 +124,34 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } else { execution.setVariable("serviceType", serviceType) } - + // target model info String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) execution.setVariable("modelInvariantUuid", modelInvariantUuid) execution.setVariable("model-invariant-id-target", modelInvariantUuid) - + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) execution.setVariable("modelUuid", modelUuid) execution.setVariable("model-version-id-target", modelUuid) - + String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled) if(serviceModelName == null) { serviceModelName = "" } - execution.setVariable("serviceModelName", serviceModelName) - + execution.setVariable("serviceModelName", serviceModelName) + //operationId String operationId = jsonUtil.getJsonValue(siRequest, "operationId") if (isBlank(operationId)) { operationId = UUID.randomUUID().toString() - } - execution.setVariable("operationId", operationId) + } + execution.setVariable("operationId", operationId) execution.setVariable("operationType", "update") execution.setVariable("hasResourcetoUpdate", false) - + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") } catch (BpmnError e) { @@ -155,164 +163,69 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } - - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" + /** + * Gets the service instance and its relationships from aai + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // serviceInstanceName - String serviceInstanceName = execution.getVariable("serviceInstanceName") - if(isBlank(serviceInstanceName) && utils.nodeExists(siData, "service-instance-name")) { - serviceInstanceName = utils.getNodeText(siData, "service-instance-name") - execution.setVariable("serviceInstanceName", serviceInstanceName) - } - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) - - def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - - //get related service instances (vnf/network or volume) for delete - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - - JSONArray jArray = new JSONArray() - - XmlParser xmlParser = new XmlParser() - Node root = xmlParser.parseText(siData) - def relation_list = utils.getChildNode(root, 'relationship-list') - def relationships = utils.getIdenticalChildren(relation_list, 'relationship') - - for (def relation: relationships) { - def jObj = getRelationShipData(relation, isDebugEnabled) - jArray.put(jObj) - } - - execution.setVariable("serviceRelationShip", jArray.toString()) - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) + execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) + execution.setVariable("model-version-id-original", si.getModelVersionId()) + + JSONObject ob = new JSONObject(wrapper.getJson()) + JSONArray ar = ob.getJSONObject("relationship-list").getJSONArray("relationship") + + execution.setVariable("serviceRelationShip", ar.toString()) + + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + }catch(NotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service-instance does not exist AAI") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - - private JSONObject getRelationShipData(node, isDebugEnabled){ - JSONObject jObj = new JSONObject() - - def relation = utils.nodeToString(node) - def rt = utils.getNodeText(relation, "related-to") - - def rl = utils.getNodeText(relation, "related-link") - utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) - - def rl_datas = utils.getIdenticalChildren(node, "relationship-data") - for(def rl_data : rl_datas) { - def eKey = utils.getChildNodeText(rl_data, "relationship-key") - def eValue = utils.getChildNodeText(rl_data, "relationship-value") - - if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){ - jObj.put("resourceInstanceId", eValue) - } - } - - def rl_props = utils.getIdenticalChildren(node, "related-to-property") - for(def rl_prop : rl_props) { - def eKey = utils.getChildNodeText(rl_prop, "property-key") - def eValue = utils.getChildNodeText(rl_prop, "property-value") - if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ - jObj.put("resourceType", eValue) - } - } - - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - return jObj - } - - public void preCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void postCompareModelVersions(DelegateExecution execution) { + public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled) - + def hasResourcetoUpdate = false def hasResourcetoAdd = false def hasResourcetoDelete = false List addResourceList = execution.getVariable("addResourceList") List delResourceList = execution.getVariable("delResourceList") - + if(addResourceList != null && !addResourceList.isEmpty()) { hasResourcetoAdd = true } - + if(delResourceList != null && !delResourceList.isEmpty()) { hasResourcetoDelete = true } - + hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate) - - utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) + + utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) } - + /** * Init the service Operation Status */ @@ -367,28 +280,28 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) } - + /** * Update the service Operation Status */ - public void preUpdateServiceOperationStatus(DelegateExecution execution){ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) - + try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") String operationType = execution.getVariable("operationType") String serviceName = execution.getVariable("serviceInstanceName") - String result = execution.getVariable("operationResult") + String result = execution.getVariable("operationResult") String progress = execution.getVariable("progress") String reason = execution.getVariable("operationReason") String userId = "" utils.log("INFO", "progress: " + progress , isDebugEnabled) String operationContent = "Prepare service : " + execution.getVariable("operationStatus") - + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) @@ -421,7 +334,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) - + }catch(Exception e){ utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) @@ -429,7 +342,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) utils.log("INFO", "Exited " + method, isDebugEnabled) - } + } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -438,7 +351,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor try { String operationId = execution.getVariable("operationId") def hasResourcetoUpdate = execution.getVariable("hasResourcetoUpdate") - + String updateServiceResp = "" if(hasResourcetoUpdate) { // RESTResponse for API Handler (APIH) Reply Task @@ -447,7 +360,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor else { updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}""" } - + utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled) sendWorkflowResponse(execution, 202, updateServiceResp) execution.setVariable("sentSyncResponse", true) @@ -498,7 +411,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") String source = execution.getVariable("source") - + String msoCompletionRequest = """ @@ -566,5 +479,5 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index eaf3631441..85993d6c92 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -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. @@ -33,6 +33,14 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import javax.ws.rs.NotFoundException +import org.json.JSONObject import static org.apache.commons.lang3.StringUtils.isBlank @@ -100,7 +108,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String dataErrorMessage = " Element 'serviceInstanceId' is missing. " exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - + String requestAction = execution.getVariable("requestAction") execution.setVariable("requestAction", requestAction) @@ -117,20 +125,20 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("globalSubscriberId", globalSubscriberId) execution.setVariable("globalCustomerId", globalSubscriberId) - + String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) - + String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) - + // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) - + // extract cloud configuration String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") execution.setVariable("cloudConfiguration", cloudConfiguration) @@ -145,7 +153,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String sdncVersion = "1707" execution.setVariable("sdncVersion", sdncVersion) msoLogger.debug("sdncVersion: "+ sdncVersion) - + //For Completion Handler & Fallout Handler String requestInfo = """ @@ -155,10 +163,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { """ execution.setVariable(Prefix+"requestInfo", requestInfo) - - //Setting for Generic Sub Flows - execution.setVariable("GENGS_type", "service-instance") - + msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") } catch (BpmnError e) { @@ -189,120 +194,87 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - public void prepareServiceDelete(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside prepareServiceDelete() of DeleteVcpeResCustService ") - + /** + * Gets the service instance and its related resources from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - // get variable within incoming json - String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest"); - - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - - msoLogger.debug("serviceInstanceAaiRecord: "+serviceInstanceAaiRecord) - serviceInstanceAaiRecord = utils.removeXmlNamespaces(serviceInstanceAaiRecord) - - def (TXC_found, TXC_id) = new Tuple(false, null) - def (BRG_found, BRG_id) = new Tuple(false, null) - List relatedVnfIdList = [] - - for(Node rel: utils.getMultNodeObjects(serviceInstanceAaiRecord, "relationship")) { - def relto = utils.getChildNodeText(rel, "related-to") - def relink = utils.getChildNodeText(rel, "related-link") - msoLogger.debug("check: "+relto+" link: "+relink) - - if(isBlank(relto) || isBlank(relink)) { - - } else if(relto == "generic-vnf") { - def id = relink.substring(relink.indexOf("/generic-vnf/")+13) - if(id.endsWith("/")) { - id = id.substring(0, id.length()-1) + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + AAIResultWrapper wrapper = resourceClient.get(uri, NotFoundException.class) + Optional relationships = wrapper.getRelationships() + + def (TXC_found, TXC_id) = new Tuple(false, null) + def (BRG_found, BRG_id) = new Tuple(false, null) + List relatedVnfIdList = [] + + if(relationships.isPresent()){ + + List vnfUris = relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF) + for(AAIResourceUri u:vnfUris){ + Map keys = u.getURIKeys() + String vnfId = keys.get("vnf-id") + relatedVnfIdList.add(vnfId) } - - relatedVnfIdList.add(id) - - } else if(relto == "allotted-resource") { - def (type, id) = getAaiAr(execution, relink) - - if(isBlank(type) || isBlank(id)) { - - } else if(type == "TunnelXConn" || type == "Tunnel XConn") { - msoLogger.debug("TunnelXConn AR found") - TXC_found = true - TXC_id = id - - } else if(type == "BRG") { - msoLogger.debug("BRG AR found") - BRG_found = true - BRG_id = id + List arUris = relationships.get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) + for(AAIResourceUri u:arUris){ + String ar = resourceClient.get(u).getJson() + + def type = jsonUtil.getJsonValue(ar, "type") + def id = jsonUtil.getJsonValue(ar, "id") + + if(type == "TunnelXConn" || type == "Tunnel XConn") { + msoLogger.debug("TunnelXConn AR found") + TXC_found = true + TXC_id = id + + }else if(type == "BRG") { + msoLogger.debug("BRG AR found") + BRG_found = true + BRG_id = id + } + + execution.setVariable(Prefix+"TunnelXConn", TXC_found) + execution.setVariable("TXC_allottedResourceId", TXC_id) + msoLogger.debug("TXC_allottedResourceId: " + TXC_id) + + execution.setVariable(Prefix+"BRG", BRG_found) + execution.setVariable("BRG_allottedResourceId", BRG_id) + msoLogger.debug("BRG_allottedResourceId: " + BRG_id) + } } + + execution.setVariable(Prefix+"vnfsCount", relatedVnfIdList.size()) + if(relatedVnfIdList.size() > 0) { + execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) + } + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - - execution.setVariable(Prefix+"TunnelXConn", TXC_found) - execution.setVariable("TXC_allottedResourceId", TXC_id) - msoLogger.debug("TXC_allottedResourceId: " + TXC_id) - - execution.setVariable(Prefix+"BRG", BRG_found) - execution.setVariable("BRG_allottedResourceId", BRG_id) - msoLogger.debug("BRG_allottedResourceId: " + BRG_id) - - int vnfsCount = relatedVnfIdList.size() - execution.setVariable(Prefix+"vnfsCount", vnfsCount) - msoLogger.debug(" "+Prefix+"vnfsCount : " + vnfsCount) - if(vnfsCount > 0) { - execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) - } - - msoLogger.trace("Completed prepareServiceDelete() of DeleteVcpeResCustService ") - } catch (BpmnError e){ + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceDelete() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private getAaiAr(DelegateExecution execution, String relink) { - def isDebugEnabled = execution.getVariable(DebugFlag) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + relink - - msoLogger.debug("get AR info " + aaiEndpoint) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - msoLogger.debug("get AR info responseCode:" + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - msoLogger.debug("get AR info " + aaiResponse) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return new Tuple2(null, null) + }catch(NotFoundException e) { + msoLogger.debug("Service Instance does not exist AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - - def type = utils.getNodeText(aaiResponse, "type") - def id = utils.getNodeText(aaiResponse, "id") - - return new Tuple2(type, id) } - - + + // ******************************* - // + // // ******************************* public void prepareVnfAndModulesDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) @@ -316,7 +288,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { if (vnfList.size() > 0 ) { vnfId = vnfList.get(vnfsDeletedCount.intValue()) } - + execution.setVariable("vnfId", vnfId) msoLogger.debug("need to delete vnfId:" + vnfId) @@ -327,7 +299,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } - + // ******************************* // Validate Vnf request Section -> increment count // ******************************* @@ -338,9 +310,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { try { int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") vnfsDeletedCount++ - + execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) - + msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) } catch (Exception ex) { // try error in method block @@ -349,7 +321,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - + // ***************************************** // Prepare Completion request Section // ***************************************** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 8a8aa2b2ad..3c08779513 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -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. @@ -37,12 +37,19 @@ import static org.apache.commons.lang3.StringUtils.* import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException /** * This groovy class supports the DoCreateAllottedResourceBRG.bpmn process. * * @author - * + * * Inputs: * @param - msoRequestId * @param - isDEbugLogEnabled @@ -57,15 +64,15 @@ import org.onap.so.logger.MsoLogger * @param - allottedResourceRole * @param - allottedResourceType * @param - brgWanMacAddress - * @param - vni - * @param - vgmuxBearerIP + * @param - vni + * @param - vgmuxBearerIP * * Outputs: * @param - rollbackData (localRB->null) * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) * @param - WorkflowException - O * @param - allottedResourceId - * @param - allottedResourceName + * @param - allottedResourceName * */ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ @@ -155,6 +162,33 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.trace("end preProcessRequest") } + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("CSI_resourceLink", uri.build().toString()) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit getServiceInstance ") + } + public void getAaiAR (DelegateExecution execution) { @@ -193,6 +227,39 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.trace("end getAaiAR") } + public void getParentServiceInstance(DelegateExecution execution) { + msoLogger.trace("getParentServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('parentServiceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY, "").queryParam("search-node-type", "service-instance").queryParam("filter", "service-instance-id:EQUALS:" + serviceInstanceId) + String json = resourceClient.get(uri).getJson() + + JSONObject obj = new JSONObject(json) + if(obj.has("result-data")){ + JSONObject ob = obj.getJSONArray("result-data").getJSONObject(0) + String resourceLink = ob.getString("resource-link") + + String[] split = resourceLink.split("/aai/") + String siRelatedLink = "/aai/" + split[1] + + execution.setVariable("PSI_resourceLink", resourceLink) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getParentServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit getParentServiceInstance ") + } + + public void createAaiAR(DelegateExecution execution) { @@ -387,9 +454,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ ${MsoUtils.xmlEscape(globalCustomerId)} - ${MsoUtils.xmlEscape(allottedResourceId)} + ${MsoUtils.xmlEscape(allottedResourceId)} brg - ${MsoUtils.xmlEscape(parentServiceInstanceId)} + ${MsoUtils.xmlEscape(parentServiceInstanceId)} ${MsoUtils.xmlEscape(modelInvariantId)} ${MsoUtils.xmlEscape(modelUUId)} @@ -575,7 +642,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - + //neeed the same url as used by vfmodules String SDNCGetRequest = """ - + SequenceFlow_7 @@ -138,26 +138,12 @@ DeleteVcpeResCustService.prepareFalloutRequest(execution)]]> SequenceFlow_04ao07f - - - - - - - - - - - + SequenceFlow_0jek18q - SequenceFlow_1ttswdr - - - SequenceFlow_1ttswdr SequenceFlow_18103ca +DeleteVcpeResCustService.getServiceInstance(execution)]]> SequenceFlow_0jek18q @@ -167,10 +153,9 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]> SequenceFlow_18103ca - + - @@ -508,11 +493,8 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]> - - - - + @@ -528,16 +510,16 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]> - + - + - + - + @@ -547,15 +529,6 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]> - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index 28bd3f76ea..1be30d62e4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0s2spoq @@ -176,29 +176,13 @@ csi.sendSyncResponse(execution)]]> - - - - - - - - - - - - + SequenceFlow_0az1n4y - SequenceFlow_1bd4711 - - - SequenceFlow_1bd4711 SequenceFlow_03i6zhx +dcsi.getServiceInstance(execution)]]> - SequenceFlow_0xhbobd SequenceFlow_0t7zinj @@ -237,7 +221,7 @@ ddsi.preCompareModelVersions(execution)]]> SequenceFlow_0zmd4rt SequenceFlow_1n8h3zt - + SequenceFlow_04qwbbf @@ -354,7 +338,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - + @@ -382,9 +366,9 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - + - + @@ -500,40 +484,30 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - - - - + - - - - - - - - + - - + + - + - + - + @@ -550,10 +524,10 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - - + + - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn index c04c2d97ea..73d3687bfa 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + @@ -70,30 +70,14 @@ def dcsi = new DoCompareModelofE2EServiceInstance() dcsi.preProcessRequest(execution) ]]> - - - - - - - - - - - - + SequenceFlow_1xzphe4 - SequenceFlow_0b6eqin - - - SequenceFlow_0b6eqin SequenceFlow_1cpg3ku +dcsi.getServiceInstance(execution)]]> - - + @@ -102,9 +86,9 @@ dcsi.postProcessAAIGET(execution)]]> - + - + @@ -114,16 +98,16 @@ dcsi.postProcessAAIGET(execution)]]> - + - + - - + + - + @@ -165,9 +149,9 @@ dcsi.postProcessAAIGET(execution)]]> - + - + @@ -178,48 +162,36 @@ dcsi.postProcessAAIGET(execution)]]> - + - + - - + + - + - - - - + - - - - - - - - - + + - + - - - - + + - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn index d7bd54cc4e..6f1609c566 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -13,49 +13,16 @@ DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() dcar.preProcessRequest(execution)]]> - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - found + SequenceFlow_1a2mcyk SequenceFlow_0gbsa12 - - SequenceFlow_6 - - - SequenceFlow_17p4ohs + SequenceFlow_1vg5rfa SequenceFlow_11 - - - - - - - - - - - - SequenceFlow_1m8u8dl - SequenceFlow_1vg5rfa - - - - SequenceFlow_1vg5rfa - SequenceFlow_17p4ohs - SequenceFlow_0f7u5pu - - - - - - SequenceFlow_0f7u5pu - SequenceFlow_16o7col - - - - SequenceFlow_16o7col - - - - + SequenceFlow_1h61pqs @@ -314,9 +243,6 @@ dcar.validateSDNCResp(execution, response, "get" )]]> SequenceFlow_11 - - - SequenceFlow_1iy3cqb @@ -334,6 +260,22 @@ dcar.generateOutputs(execution)]]> + + + SequenceFlow_2 + SequenceFlow_1a2mcyk + + + + SequenceFlow_1m8u8dl + SequenceFlow_1vg5rfa + + @@ -357,57 +299,16 @@ dcar.generateOutputs(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - + @@ -416,11 +317,10 @@ dcar.generateOutputs(execution)]]> - - - + + - + @@ -545,51 +445,12 @@ dcar.generateOutputs(execution)]]> - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -672,7 +533,7 @@ dcar.generateOutputs(execution)]]> - + @@ -698,18 +559,11 @@ dcar.generateOutputs(execution)]]> - + - + - - - - - - - @@ -750,6 +604,19 @@ dcar.generateOutputs(execution)]]> + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn index f26bae0b39..3deaae4e0d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -12,50 +12,17 @@ DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() dcar.preProcessRequest(execution)]]> - - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - + - found + SequenceFlow_01zb7a0 SequenceFlow_0gbsa12 - - SequenceFlow_6 - - - SequenceFlow_17p4ohs + SequenceFlow_0vrw9a9 SequenceFlow_11 SequenceFlow_0q1hz2p - - - - - - - - - - - - SequenceFlow_1m8u8dl - SequenceFlow_1vg5rfa - - - - SequenceFlow_1vg5rfa - SequenceFlow_17p4ohs - SequenceFlow_0f7u5pu - - - - - - SequenceFlow_0f7u5pu - SequenceFlow_16o7col - - - - SequenceFlow_16o7col - - - - SequenceFlow_1h61pqs @@ -300,7 +228,7 @@ dcar.validateSDNCResp(execution, response, "get" )]]> SequenceFlow_1m8u8dl SequenceFlow_0z8luou - + @@ -313,9 +241,6 @@ dcar.validateSDNCResp(execution, response, "get" )]]> SequenceFlow_11 - - - SequenceFlow_1iy3cqb @@ -334,6 +259,23 @@ dcar.generateOutputs(execution)]]> + + SequenceFlow_2 + SequenceFlow_01zb7a0 + + + + SequenceFlow_1m8u8dl + SequenceFlow_0vrw9a9 + + + + @@ -357,57 +299,16 @@ dcar.generateOutputs(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - + - + @@ -416,11 +317,10 @@ dcar.generateOutputs(execution)]]> - - - + + - + @@ -538,53 +438,6 @@ dcar.generateOutputs(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -663,9 +516,9 @@ dcar.generateOutputs(execution)]]> - + - + @@ -691,23 +544,16 @@ dcar.generateOutputs(execution)]]> - + - + - - - - - - - - + - + @@ -750,6 +596,26 @@ dcar.generateOutputs(execution)]]> + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn index 07de3fc0b1..3fea7467c5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn @@ -33,32 +33,17 @@ dcsi.postProcessSDNCAssign(execution)]]> SequenceFlow_0o6bjmn - - - - - - - - - - - + SequenceFlow_0k06cqp - SequenceFlow_1oql7zl - - - SequenceFlow_1oql7zl SequenceFlow_0o6bjmn +dcsi.getServiceInstance(execution)]]> - + - @@ -81,9 +66,6 @@ dcsi.postProcessAAIGET2(execution)]]> - - - @@ -102,26 +84,17 @@ dcsi.postProcessAAIGET2(execution)]]> - - - + + - + - - - - - - - - - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index a5fadcf14b..eeaa5e451a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -12,21 +12,6 @@ def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRequest(execution) ]]> - - - - - - - - - - - - - SequenceFlow_1i7t9hq - SequenceFlow_4 - @@ -38,7 +23,7 @@ dcsi.preProcessRequest(execution) - SequenceFlow_1w01tqs + SequenceFlow_1i7t9hq SequenceFlow_129ih1g @@ -82,14 +67,6 @@ dcsi.postProcessRollback(execution) - - SequenceFlow_4 - SequenceFlow_1w01tqs - - - SequenceFlow_129ih1g SequenceFlow_1tkgqu3 @@ -179,7 +156,7 @@ dcsi.prepareDecomposeService(execution)]]> SequenceFlow_1i7t9hq - + SequenceFlow_1hbesp9 @@ -258,18 +235,6 @@ dcsi.doServicePreOperation(execution)]]> - - - - - - - - - - - - @@ -314,18 +279,6 @@ dcsi.doServicePreOperation(execution)]]> - - - - - - - - - - - - @@ -451,9 +404,12 @@ dcsi.doServicePreOperation(execution)]]> - + + + + - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn index 4c107c7cb4..77c62e573d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -13,21 +13,7 @@ def dcsi = new DoCreateE2EServiceInstanceV2() dcsi.preProcessRequest(execution) ]]> - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - + @@ -83,13 +69,6 @@ dcsi.postProcessRollback(execution) - - SequenceFlow_4 - SequenceFlow_10aubhh - - SequenceFlow_129ih1g SequenceFlow_03fabby @@ -225,9 +204,8 @@ def csi = new DoCreateE2EServiceInstanceV2() csi.postOtherControllerType(execution)]]> - - SequenceFlow_10aubhh + SequenceFlow_2 @@ -486,23 +464,13 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - - - - - - - - + - + - + - - - @@ -545,9 +513,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - - - @@ -752,13 +717,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn index 12dbfe6dde..2f5fa39dbc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1n61wit @@ -332,19 +332,6 @@ DoCreateNetworkInstance.processJavaException(execution)]]> SequenceFlow_14 - - - - - - - - - - - SequenceFlow_0ftylq3 - SequenceFlow_3 - isNameSentYes_SequenceFlow SequenceFlow_6 @@ -353,23 +340,7 @@ def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.callRESTQueryAAINetworkName(execution)]]> - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - siFoundNo - - + SequenceFlow_16 SequenceFlow_15 @@ -413,7 +384,7 @@ DoCreateNetworkInstance.preProcessRequest(execution)]]> - siFoundYes + SequenceFlow_3 isNameSentYes_SequenceFlow isNameSentNo_SequenceFlow @@ -535,6 +506,13 @@ def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.postProcessResponse(execution)]]> + + SequenceFlow_0ftylq3 + SequenceFlow_3 + + @@ -898,37 +876,12 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]> - - - - - - - - - - + - - - - - - - + - - - - - - - - - - - + @@ -961,7 +914,7 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]> - + @@ -1358,6 +1311,9 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn index 29116a67fc..2c6f5ee61d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -12,7 +12,7 @@ def dcsi = new DoCreateServiceInstance() dcsi.getAAICustomerById(execution)]]> - + SequenceFlow_1 SequenceFlow_2 @@ -21,7 +21,6 @@ def dcsi = new DoCreateServiceInstance() dcsi.preProcessRequest(execution) ]]> - SequenceFlow_156ih25 SequenceFlow_14 @@ -49,24 +48,12 @@ dcsi.postProcessSDNCAssign(execution)]]> SequenceFlow_9 - SequenceFlow_01q6pl4 + SequenceFlow_10 - - - - - - - - - - - SequenceFlow_11fnnkb - SequenceFlow_4 - + @@ -78,19 +65,9 @@ dcsi.postProcessSDNCAssign(execution)]]> - SequenceFlow_1uw2p9a - SequenceFlow_1w01tqs + SequenceFlow_3 SequenceFlow_1jhzmzn - - SequenceFlow_3 - SequenceFlow_11fnnkb - SequenceFlow_1uw2p9a - - - - - SequenceFlow_0tgrn11 @@ -143,37 +120,6 @@ dcsi.postProcessRollback(execution) - - SequenceFlow_4 - SequenceFlow_1w01tqs - - - - - - - - - - - - - - - SequenceFlow_10 - SequenceFlow_0tx5frq - - - - - SequenceFlow_0tx5frq - SequenceFlow_01q6pl4 - - SequenceFlow_1jhzmzn SequenceFlow_16sdyz9 @@ -243,24 +189,18 @@ dcsi.processJavaException(execution)]]> - + + - + - + - + - - - - - - - @@ -292,39 +232,15 @@ dcsi.processJavaException(execution)]]> - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - @@ -385,18 +301,6 @@ dcsi.processJavaException(execution)]]> - - - - - - - - - - - - @@ -419,28 +323,6 @@ dcsi.processJavaException(execution)]]> - - - - - - - - - - - - - - - - - - - - - - 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 ac48776c95..26a4112d59 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 @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -128,26 +128,14 @@ doCreateVfModuleVolumeV2.executeMethod('validateVnfResponse', execution, isDebug - - - - - - - - + SequenceFlow_1wi1cf9 - SequenceFlow_1vmbvy8 - - - SequenceFlow_1vmbvy8 SequenceFlow_1dpt7ul +doCreateVfModuleVolumeV2.executeMethod('getServiceInstance', execution, isDebugLogEnabled)]]> - - + @@ -330,31 +318,21 @@ doCreateVfModuleVolumeV2.executeMethod('validateGetServiceInstanceCall', executi - - - - + - - - - - - - - + - + - + - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn index dacce53963..a093beae91 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -13,39 +13,6 @@ DoCreateVnf createVnf = new DoCreateVnf() createVnf.preProcessRequest(execution)]]> - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - - - SequenceFlow_7 vnfExistYes @@ -77,10 +44,6 @@ ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.")]]> - - SequenceFlow_6 - - SequenceFlow_10 @@ -200,7 +163,7 @@ DoCreateVnf createVnf = new DoCreateVnf() createVnf.postProcessCreateGenericVnf(execution)]]> - found + SequenceFlow_1mvplyi VnfNameNotSpecified1 VnfNameSpecified1 @@ -271,6 +234,14 @@ createVnfInfra.validateSDNCResponse(execution, response, "get")]]> + + SequenceFlow_2 + SequenceFlow_1mvplyi + + + @@ -283,67 +254,20 @@ doCreateVnf.prepUpdateAAIGenericVnf(execution)]]> - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - + @@ -630,6 +554,16 @@ doCreateVnf.prepUpdateAAIGenericVnf(execution)]]> + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index 73c21090ea..2e12dd3b96 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -15,13 +15,6 @@ ddsi.preProcessRequest(execution) SequenceFlow_0e7inkl - - SequenceFlow_188ejvu - SequenceFlow_0vi0sv6 - - SequenceFlow_0oj2anh SequenceFlow_1ev7z6q @@ -49,9 +42,8 @@ ex.processJavaException(execution)]]> - + - SequenceFlow_1ubor5z SequenceFlow_1dza4q4 @@ -93,7 +85,7 @@ ddsi.preResourceDelete(execution, resourceName )]]> SequenceFlow_1ev7z6q - SequenceFlow_0vi0sv6 + SequenceFlow_11e6bfy SequenceFlow_1ym9otf SequenceFlow_1j08ko3 - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - SequenceFlow_1j08ko3 SequenceFlow_03c0zlq @@ -219,9 +195,6 @@ ddsi.parseNextResource(execution)]]> - - - @@ -237,9 +210,9 @@ ddsi.parseNextResource(execution)]]> - + - + @@ -249,13 +222,6 @@ ddsi.parseNextResource(execution)]]> - - - - - - - @@ -327,16 +293,6 @@ ddsi.parseNextResource(execution)]]> - - - - - - - - - - @@ -467,4 +423,4 @@ ddsi.parseNextResource(execution)]]> - \ No newline at end of file + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn index 3e76f61224..2df19abf68 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -15,12 +15,12 @@ ddsi.preProcessRequest(execution) SequenceFlow_06tonva - - SequenceFlow_188ejvu + + SequenceFlow_11e6bfy SequenceFlow_00a3ijv +ddsi.getServiceInstance(execution)]]> SequenceFlow_0t5f2dt @@ -48,7 +48,7 @@ ex.processJavaException(execution)]]> - + SequenceFlow_1931m8u @@ -122,22 +122,6 @@ ddsi.preSDNCResourceDelete(execution, resourceName )]]> SequenceFlow_0akcnw7 SequenceFlow_0uc2beq - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - SequenceFlow_1qzxy2i @@ -430,7 +414,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> - + @@ -447,10 +431,9 @@ ddsi.preInitResourcesOperStatus(execution)]]> - - + - + @@ -553,16 +536,6 @@ ddsi.preInitResourcesOperStatus(execution)]]> - - - - - - - - - - @@ -781,10 +754,10 @@ ddsi.preInitResourcesOperStatus(execution)]]> - + - + @@ -925,4 +898,4 @@ ddsi.preInitResourcesOperStatus(execution)]]> - \ No newline at end of file + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn index fae66a7381..d9a93e66d8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn @@ -67,28 +67,14 @@ ddsi.preProcessSDNCDelete(execution)]]> - - - - - - - - - - + + SequenceFlow_1jqc16k - SequenceFlow_1grea1r - - - - SequenceFlow_1grea1r SequenceFlow_1up0j5r +ddsi.getServiceInstance(execution)]]> - SequenceFlow_0riudmc @@ -250,26 +236,16 @@ ddsi.postProcessSDNCDelete(execution, response, "delete")]]> - - - - + - + - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index a46d8d4de2..ef3340e887 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -113,7 +113,7 @@ ddsi.postProcessAAIPUT(execution)]]> SequenceFlow_1demy08 - + SequenceFlow_0ku36oy @@ -173,40 +173,8 @@ dcsi.postProcessRollback(execution) - - SequenceFlow_1demy08 - SequenceFlow_1cy5gq2 - - - - - - - - - - - - - - - - SequenceFlow_1cy5gq2 - SequenceFlow_1vy856f - - - SequenceFlow_1vy856f - SequenceFlow_14ggluy - - - - - SequenceFlow_14ggluy + SequenceFlow_1demy08 SequenceFlow_1kx5ke9 - - - + - + @@ -504,36 +470,6 @@ dcsi.preProcessAAIPUT(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn index 1589633e59..b53e87d34a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn @@ -184,7 +184,7 @@ csi.postProcessForAddResource(execution)]]> - SequenceFlow_1ixphei + SequenceFlow_1a65s3k SequenceFlow_1lppnhy def dcsi = new DoUpdateE2EServiceInstanceRollback() dcsi.postProcessAAIPUT(execution)]]> - + @@ -287,38 +287,6 @@ rbk.postProcessRequest(execution)]]> - - SequenceFlow_1a65s3k - SequenceFlow_0870pzc - - - - - - - - - - - - - - - SequenceFlow_0870pzc - SequenceFlow_1f31l5s - - - - SequenceFlow_1f31l5s - SequenceFlow_1ixphei - - - - @@ -602,9 +570,9 @@ dcsi.postProcessAAIGET(execution)]]> - + - + @@ -764,36 +732,6 @@ dcsi.postProcessAAIGET(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn index 306b05cea1..b82b1da951 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -231,42 +231,14 @@ DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(execution)]]> - siFoundYes + SequenceFlow_3 SequenceFlow_24 - - siFoundNo - - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_3 - - + SequenceFlow_59 SequenceFlow_13 @@ -340,6 +312,13 @@ def DoUpdateNetworkInstance = new DoUpdateNetworkInstance() DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]> + + SequenceFlow_7 + SequenceFlow_3 + + @@ -430,7 +409,7 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]> - + @@ -682,42 +661,16 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]> - - - - - - - - - - + - - - - - - - + - - - - - - - - - - - - + @@ -824,6 +777,9 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]> + + + -- cgit 1.2.3-korg