X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-infrastructure-common%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fscripts%2FDoCreateVnf.groovy;h=b35aab1176c3d7c02940b0edfebb84b10c49922f;hb=6ba0a22bc952232d14d2d24c5f73a42aae2791a9;hp=df4698de9dd7f044839aa747c24ce266410baddc;hpb=dfd41cdb1ee442f218fec67643197dd839367bc3;p=so.git diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index df4698de9d..b35aab1176 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -105,7 +106,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String vnfName = execution.getVariable("vnfName") if (vnfName.equals("") || vnfName.equals("null")) { - vnfName = null + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable("vnfId")) + if(resourceClient.exists(uri)){ + exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.") + } + + } execution.setVariable("DoCVNF_vnfName", vnfName) msoLogger.debug("Incoming Vnf Name is: " + vnfName) @@ -260,7 +267,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if(resourceClient.exists(uri)){ Map keys = uri.getURIKeys() - execution.setVariable("globalCustomer", keys.get("global-customer-id")) + execution.setVariable("globalCustomerId", keys.get("global-customer-id")) execution.setVariable("serviceType", keys.get("service-type")) execution.setVariable("GENGS_siResourceLink", uri.build().toString())