+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. \r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.openecomp.mso.bpmn.infrastructure.scripts;\r
-\r
-import static org.apache.commons.lang3.StringUtils.*;\r
-\r
-import org.apache.commons.lang3.*\r
-import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.delegate.DelegateExecution\r
-import org.json.JSONArray;\r
-import org.json.JSONObject;\r
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil\r
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
-import org.openecomp.mso.bpmn.core.RollbackData\r
-import org.openecomp.mso.bpmn.core.WorkflowException\r
-import org.openecomp.mso.bpmn.core.json.JsonUtils\r
-import org.springframework.web.util.UriUtils;\r
-\r
-import groovy.json.*\r
-\r
-/**\r
- * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.\r
- *\r
- * Inputs:\r
- * @param - msoRequestId\r
- * @param - globalSubscriberId\r
- * @param - subscriptionServiceType\r
- * @param - serviceInstanceId\r
- * @param - serviceInstanceName - O\r
- * @param - serviceModelInfo\r
- * @param - productFamilyId\r
- * @param - disableRollback\r
- * @param - failExists - TODO\r
- * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)\r
- * @param - sdncVersion ("1610")\r
- * @param - serviceDecomposition - Decomposition for R1710 \r
- * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)\r
- *\r
- * Outputs:\r
- * @param - rollbackData (localRB->null)\r
- * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)\r
- * @param - WorkflowException\r
- * @param - serviceInstanceName - (GET from AAI if null in input)\r
- *\r
- */\r
-public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {\r
-\r
- String Prefix="DCRESI_"\r
- private static final String DebugFlag = "isDebugEnabled"\r
- \r
- ExceptionUtil exceptionUtil = new ExceptionUtil()\r
- JsonUtils jsonUtil = new JsonUtils()\r
-\r
- public void preProcessRequest (DelegateExecution execution) {\r
- //only for dug\r
- execution.setVariable("isDebugLogEnabled","true")\r
- execution.setVariable("unit_test", "true")\r
- execution.setVariable("skipVFC", "true")\r
- \r
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- String msg = ""\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRequest *****", isDebugEnabled)\r
- \r
- utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled) \r
-\r
- try {\r
- execution.setVariable("prefix", Prefix)\r
- //Inputs\r
- //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology\r
- String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId\r
- utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)\r
- \r
- //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology\r
- String serviceType = execution.getVariable("serviceType")\r
- utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)\r
- \r
- //requestDetails.requestParameters. for SDNC assignTopology\r
- String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId\r
-\r
- if (isBlank(globalSubscriberId)) {\r
- msg = "Input globalSubscriberId is null"\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
- }\r
- \r
- if (isBlank(serviceType)) {\r
- msg = "Input serviceType is null"\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
- }\r
- \r
- if (productFamilyId == null) {\r
- execution.setVariable("productFamilyId", "")\r
- }\r
- \r
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')\r
- if (isBlank(sdncCallbackUrl)) {\r
- msg = "URN_mso_workflow_sdncadapter_callback is null"\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
- }\r
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)\r
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)\r
-\r
- //requestDetails.modelInfo.for AAI PUT servieInstanceData \r
- //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData \r
- String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
- String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
- String uuiRequest = execution.getVariable("uuiRequest")\r
- utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)\r
- \r
- String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")\r
- utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)\r
- \r
- String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")\r
- utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)\r
- \r
- String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")\r
- utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)\r
- execution.setVariable("serviceModelName", serviceModelName)\r
- \r
- //aai serviceType and Role can be setted as fixed value now.\r
- String aaiServiceType = serviceType\r
- String aaiServiceRole = serviceType+"Role"\r
- \r
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)\r
- execution.setVariable("modelUuid", modelUuid)\r
-\r
- //AAI PUT\r
- String oStatus = execution.getVariable("initialStatus") ?: ""\r
- utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)\r
- if ("TRANSPORT".equalsIgnoreCase(serviceType))\r
- {\r
- oStatus = "Created"\r
- }\r
- \r
- \r
-\r
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"\r
- utils.log("INFO","statusLine: " + statusLine, isDebugEnabled) \r
- AaiUtil aaiUriUtil = new AaiUtil(this)\r
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) \r
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)\r
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)\r
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)\r
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)\r
- /*\r
- String serviceInstanceData =\r
- """<service-instance xmlns=\"${namespace}\">\r
- <service-instance-id>${serviceInstanceId}</service-instance-id>\r
- <service-instance-name>${serviceInstanceName}</service-instance-name>\r
- <service-type>${aaiServiceType}</service-type>\r
- <service-role>${aaiServiceRole}</service-role>\r
- ${statusLine}\r
- <model-invariant-id>${modelInvariantUuid}</model-invariant-id>\r
- <model-version-id>${modelUuid}</model-version-id>\r
- </service-instance>""".trim()\r
- */\r
- //begin only for test\r
- String serviceInstanceData =\r
- """<service-instance xmlns=\"${namespace}\">\r
- <service-instance-id>${serviceInstanceId}</service-instance-id>\r
- <service-instance-name>${serviceInstanceName}</service-instance-name>\r
- <service-type>${aaiServiceType}</service-type>\r
- <service-role>${aaiServiceRole}</service-role>\r
- ${statusLine}\r
- </service-instance>""".trim()\r
- //end only for test\r
- execution.setVariable("serviceInstanceData", serviceInstanceData)\r
- utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)\r
- utils.logAudit(serviceInstanceData)\r
- utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)\r
- utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)\r
- \r
- execution.setVariable("serviceSDNCCreate", "false")\r
- execution.setVariable("operationStatus", "Waiting deploy resource...") \r
-\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception ex){\r
- msg = "Exception in preProcessRequest " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
-\r
- public void postProcessAAIGET(DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET ***** ", isDebugEnabled)\r
- String msg = ""\r
-\r
- try {\r
- String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
- boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")\r
- if(!succInAAI){\r
- utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)\r
- WorkflowException workflowException = execution.getVariable("WorkflowException")\r
- utils.logAudit("workflowException: " + workflowException)\r
- if(workflowException != null){\r
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())\r
- }\r
- else\r
- {\r
- msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)\r
- }\r
- }\r
- else\r
- {\r
- boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")\r
- if(foundInAAI){\r
- utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)\r
- msg = "ServiceInstance already exists in AAI:" + serviceInstanceName\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)\r
- }\r
- }\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception ex) {\r
- msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
-\r
- public void postProcessAAIPUT(DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIPUT ***** ", isDebugEnabled)\r
- String msg = ""\r
- try {\r
- String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")\r
- if(!succInAAI){\r
- utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)\r
- WorkflowException workflowException = execution.getVariable("WorkflowException")\r
- utils.logAudit("workflowException: " + workflowException)\r
- if(workflowException != null){\r
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())\r
- }\r
- }\r
- else\r
- {\r
- //start rollback set up\r
- RollbackData rollbackData = new RollbackData()\r
- def disableRollback = execution.getVariable("disableRollback")\r
- rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())\r
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")\r
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)\r
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))\r
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))\r
- execution.setVariable("rollbackData", rollbackData)\r
- }\r
-\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception ex) {\r
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
- public void postProcessAAIGET2(DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET2 ***** ", isDebugEnabled)\r
- String msg = ""\r
-\r
- try {\r
- String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
- boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")\r
- if(!succInAAI){\r
- utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)\r
- WorkflowException workflowException = execution.getVariable("WorkflowException")\r
- utils.logAudit("workflowException: " + workflowException)\r
- if(workflowException != null){\r
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())\r
- }\r
- else\r
- {\r
- msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)\r
- }\r
- }\r
- else\r
- {\r
- boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")\r
- if(foundInAAI){\r
- String aaiService = execution.getVariable("GENGS_service")\r
- if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {\r
- execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))\r
- utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)\r
- }\r
- }\r
- }\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception ex) {\r
- msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
-\r
- public void preProcessRollback (DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRollback ***** ", isDebugEnabled)\r
- try {\r
- \r
- Object workflowException = execution.getVariable("WorkflowException");\r
-\r
- if (workflowException instanceof WorkflowException) {\r
- utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)\r
- execution.setVariable("prevWorkflowException", workflowException);\r
- //execution.setVariable("WorkflowException", null);\r
- }\r
- } catch (BpmnError e) {\r
- utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)\r
- } catch(Exception ex) {\r
- String msg = "Exception in preProcessRollback. " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
-\r
- public void postProcessRollback (DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessRollback ***** ", isDebugEnabled)\r
- String msg = ""\r
- try {\r
- Object workflowException = execution.getVariable("prevWorkflowException");\r
- if (workflowException instanceof WorkflowException) {\r
- utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)\r
- execution.setVariable("WorkflowException", workflowException);\r
- }\r
- execution.setVariable("rollbackData", null)\r
- } catch (BpmnError b) {\r
- utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)\r
- throw b;\r
- } catch(Exception ex) {\r
- msg = "Exception in postProcessRollback. " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
- /**\r
- * Init the service Operation Status\r
- */\r
- public void preUpdateServiceOperationStatus(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- \r
- try{\r
- String serviceId = execution.getVariable("serviceInstanceId")\r
- String operationId = execution.getVariable("operationId")\r
- String serviceName = execution.getVariable("serviceInstanceName")\r
- String operationType = "CREATE"\r
- String userId = ""\r
- String result = "processing"\r
- String progress = execution.getVariable("progress")\r
- utils.log("INFO", "progress: " + progress , isDebugEnabled)\r
- if ("100".equalsIgnoreCase(progress))\r
- {\r
- result = "finished"\r
- }\r
- String reason = ""\r
- String operationContent = "Prepare service creation : " + execution.getVariable("operationStatus")\r
- \r
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)\r
- serviceId = UriUtils.encode(serviceId,"UTF-8")\r
- execution.setVariable("serviceInstanceId", serviceId)\r
- execution.setVariable("operationId", operationId)\r
- execution.setVariable("operationType", operationType)\r
-\r
- def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"\r
- execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
-\r
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
- String payload =\r
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
- xmlns:ns="http://org.openecomp.mso/requestsdb">\r
- <soapenv:Header/>\r
- <soapenv:Body>\r
- <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
- <serviceId>${serviceId}</serviceId>\r
- <operationId>${operationId}</operationId>\r
- <serviceName>${serviceName}</serviceName>\r
- <operationType>${operationType}</operationType>\r
- <userId>${userId}</userId>\r
- <result>${result}</result>\r
- <operationContent>${operationContent}</operationContent>\r
- <progress>${progress}</progress>\r
- <reason>${reason}</reason>\r
- </ns:updateServiceOperationStatus>\r
- </soapenv:Body>\r
- </soapenv:Envelope>"""\r
-\r
- payload = utils.formatXml(payload)\r
- execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)\r
- utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)\r
- \r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) \r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
-\r
- public void preInitResourcesOperStatus(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
-\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preInitResourcesOperStatus Process ======== ", isDebugEnabled)\r
- try{\r
- String serviceId = execution.getVariable("serviceInstanceId")\r
- String operationId = execution.getVariable("operationId")\r
- String operationType = execution.getVariable("operationType")\r
- String resourceTemplateUUIDs = ""\r
- String result = "processing"\r
- String progress = "0"\r
- String reason = ""\r
- String operationContent = "Prepare service creation"\r
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)\r
- serviceId = UriUtils.encode(serviceId,"UTF-8")\r
- execution.setVariable("serviceInstanceId", serviceId)\r
- execution.setVariable("operationId", operationId)\r
- execution.setVariable("operationType", operationType)\r
- String incomingRequest = execution.getVariable("uuiRequest")\r
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") \r
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) \r
- for(String resource : resourceList){\r
- resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":"\r
- } \r
-\r
- def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"\r
- execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
-\r
- String payload =\r
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
- xmlns:ns="http://org.openecomp.mso/requestsdb">\r
- <soapenv:Header/>\r
- <soapenv:Body>\r
- <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
- <serviceId>${serviceId}</serviceId>\r
- <operationId>${operationId}</operationId>\r
- <operationType>${operationType}</operationType>\r
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
- </ns:initResourceOperationStatus>\r
- </soapenv:Body>\r
- </soapenv:Envelope>"""\r
-\r
- payload = utils.formatXml(payload)\r
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
- utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)\r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
- /**\r
- * prepare resource create request\r
- */\r
- public void preResourceRequest(execution){\r
- def method = getClass().getSimpleName() + '.preResourceRequest(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- \r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preResourceRequest Process ======== ", isDebugEnabled)\r
- try {\r
- String resourceType = execution.getVariable("resourceType")\r
- String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
- String nsServiceName = resourceType + "_" + serviceInstanceName\r
- execution.setVariable("nsServiceName", nsServiceName)\r
- utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)\r
- String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
- String serviceType = execution.getVariable("serviceType")\r
- String serviceId = execution.getVariable("serviceInstanceId")\r
- execution.setVariable("serviceId", serviceId)\r
- String operationId = execution.getVariable("operationId")\r
- String incomingRequest = execution.getVariable("uuiRequest")\r
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") \r
- String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description") \r
- execution.setVariable("nsServiceDescription", nsServiceDescription)\r
- utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)\r
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) \r
- for(String resource : resourceList){\r
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName") \r
- if(StringUtils.containsIgnoreCase(resourceName, resourceType)){\r
- String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")\r
- String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")\r
- String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters") \r
- execution.setVariable("resourceUUID", resourceUUID)\r
- execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)\r
- execution.setVariable("resourceParameters", resourceParameters)\r
- utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)\r
- utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)\r
- utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)\r
- } \r
- }\r
- } catch (BpmnError b) {\r
- utils.log("INFO", "BPMN Error during preResourceRequest", isDebugEnabled)\r
- throw b;\r
- } catch(Exception ex) {\r
- msg = "Exception in preResourceRequest. " + ex.getMessage()\r
- utils.log("INFO", msg, isDebugEnabled)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
- /**\r
- * post config request.\r
- */\r
- public void postConfigRequest(execution){\r
- //now do noting\r
- }\r
- \r
- /***********************************************************************************************/\r
-\r
- private void loadResourcesProperties(DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- String loadFilePath = "/etc/mso/config.d/reources.json"\r
- try{\r
- def jsonPayload = new File(loadFilePath).text\r
- utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)\r
-\r
- String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())\r
- utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)\r
- \r
- String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")\r
- //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)\r
- execution.setVariable("createResourceSort", createResourceSort)\r
- \r
- String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")\r
- //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)\r
- execution.setVariable("deleteResourceSort", deleteResourceSort)\r
- \r
- \r
- String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")\r
- //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)\r
- execution.setVariable("resourceControllerType", resourceControllerType) \r
- \r
- \r
- }catch(Exception ex){\r
- // try error in method block\r
- String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- private sortCreateResource(DelegateExecution execution) {\r
- def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- String createResourceSortDef = """[\r
- {\r
- "resourceType":"vEPC"\r
- },\r
- {\r
- "resourceType":"vIMS"\r
- },\r
- {\r
- "resourceType":"vCPE"\r
- },\r
- {\r
- "resourceType":"vFW"\r
- },\r
- {\r
- "resourceType":"Underlay"\r
- },\r
- {\r
- "resourceType":"Overlay"\r
- },\r
- {\r
- "resourceType":"GRE_AAR"\r
- },\r
- {\r
- "resourceType":"APN_AAR"\r
- },\r
- {\r
- "resourceType":"VPN_SAR"\r
- },\r
- {\r
- "resourceType":"GRE_SAR"\r
- } \r
- \r
- ]""".trim()\r
- \r
- try{\r
-\r
- loadResourcesProperties(execution)\r
- String createResourceSort = execution.getVariable("createResourceSort")\r
- if (isBlank(createResourceSort)) {\r
- createResourceSort = createResourceSortDef;\r
- }\r
- \r
- List<String> sortResourceList = jsonUtil.StringArrayToList(execution, createResourceSort)\r
- utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled) \r
-\r
- JSONArray newResourceList = new JSONArray()\r
- int resSortCount = sortResourceList.size()\r
- \r
- \r
- for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) { \r
- String sortResource = sortResourceList[currentResource]\r
- String resourceType = jsonUtil.getJsonValue(sortResource, "resourceType") \r
- List<String> resourceList = execution.getVariable(Prefix+"resourceList")\r
-\r
- for (String resource : resourceList) {\r
- //utils.log("INFO", "resource : " + resource, isDebugEnabled)\r
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName")\r
- //utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)\r
- String[] split = resourceName.split("_")\r
- \r
- utils.log("INFO", "split : " + split, isDebugEnabled)\r
- int strLen = split.size()\r
- String allottedResourceType = ""\r
- \r
- if (strLen <2) {\r
- allottedResourceType = split[0]\r
- }\r
- else {\r
- allottedResourceType = split[0] + "_" + split[1]\r
- }\r
- \r
- if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {\r
- utils.log("INFO", "allottedResourceType : " + allottedResourceType + " resourceType : " + resourceType, isDebugEnabled)\r
- utils.log("INFO", "resource : " + resource , isDebugEnabled)\r
- JSONObject jsonObj = new JSONObject(resource)\r
- newResourceList.put(jsonObj)\r
- \r
- }\r
- utils.log("INFO", "Get next sort type " , isDebugEnabled)\r
- }\r
- } \r
- utils.log("INFO", "newResourceList : " + newResourceList, isDebugEnabled)\r
- String newResourceStr = newResourceList.toString() \r
- List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr) \r
- \r
- execution.setVariable(Prefix+"resourceList", newResourceListStr)\r
- utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled) \r
- \r
- }catch(Exception ex){\r
- // try error in method block\r
- String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- \r
- }\r
- /**\r
- * get service resources\r
- */\r
- public void getServiceResources(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 getServiceResources Process ======== ", isDebugEnabled)\r
- try{\r
- execution.setVariable(Prefix+"resourceCount", 0)\r
- execution.setVariable(Prefix+"nextResource", 0)\r
-\r
- String incomingRequest = execution.getVariable("uuiRequest")\r
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") \r
- utils.log("INFO", "Resources String : " + resourcesStr, isDebugEnabled)\r
- if (!isBlank(resourcesStr)) {\r
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) \r
- utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)\r
- execution.setVariable(Prefix+"resourceList", resourceList)\r
- execution.setVariable(Prefix+"resourceCount", resourceList.size())\r
- execution.setVariable(Prefix+"nextResource", 0)\r
- }\r
- \r
- int resourceNum = execution.getVariable(Prefix+"nextResource")\r
- utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)\r
- \r
- int resourceCount = execution.getVariable(Prefix+"resourceCount")\r
- utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)\r
-\r
- if (resourceNum < resourceCount) {\r
- execution.setVariable(Prefix+"resourceFinish", false)\r
- }\r
- else {\r
- execution.setVariable(Prefix+"resourceFinish", true)\r
- }\r
- sortCreateResource(execution)\r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing getServiceResources. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during getServiceResources Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- \r
- /**\r
- * prepare Decompose next resource to create request\r
- */\r
- public void preProcessDecomposeNextResource(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessDecomposeNextResource Process ======== ", isDebugEnabled)\r
- try{\r
- int resourceNum = execution.getVariable(Prefix+"nextResource")\r
- List<String> resourceList = execution.getVariable(Prefix+"resourceList")\r
- utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)\r
- \r
- String resource = resourceList[resourceNum]\r
- execution.setVariable(Prefix+"resource", resource)\r
- utils.log("INFO", "Current Resource : " + resource, isDebugEnabled)\r
-\r
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName") \r
- execution.setVariable(Prefix+"resourceName", resourceName)\r
- utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)\r
- \r
- String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")\r
- execution.setVariable("resourceUUID", resourceUUID)\r
- utils.log("INFO", "resource UUID : " + resourceUUID, isDebugEnabled)\r
- \r
- String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")\r
- execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)\r
- \r
- \r
- String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters") \r
- execution.setVariable("resourceParameters", resourceParameters)\r
- utils.log("INFO", "resource Parameters : " + resourceParameters, isDebugEnabled)\r
-\r
- execution.setVariable(Prefix+"nextResource", resourceNum + 1)\r
- utils.log("INFO", "next Resource num : " + execution.getVariable(Prefix+"nextResource"), isDebugEnabled)\r
- \r
- int resourceCount = execution.getVariable(Prefix+"resourceCount")\r
- if (resourceCount >0 ){\r
- int progress = (resourceNum*100) / resourceCount\r
- execution.setVariable("progress", progress.toString() )\r
- }\r
- \r
- execution.setVariable("operationStatus", resourceName )\r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing preProcessDecomposeNextResource. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during preProcessDecomposeNextResource Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- /**\r
- * post Decompose next resource to create request\r
- */\r
- public void postProcessDecomposeNextResource(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== STARTED DoCreateE2EServiceInstanceV2 postProcessDecomposeNextResource Process ======== ", isDebugEnabled)\r
- try{\r
- String resourceName = execution.getVariable(Prefix+"resourceName")\r
- \r
- int resourceNum = execution.getVariable(Prefix+"nextResource")\r
- utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)\r
- \r
- int resourceCount = execution.getVariable(Prefix+"resourceCount")\r
- utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)\r
-\r
- if (resourceNum < resourceCount) {\r
- execution.setVariable(Prefix+"resourceFinish", false)\r
- }\r
- else {\r
- execution.setVariable(Prefix+"resourceFinish", true)\r
- }\r
- \r
- utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)\r
- \r
- if (resourceCount >0 ){\r
- int progress = (resourceNum*100) / resourceCount\r
- execution.setVariable("progress", progress.toString() )\r
- utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)\r
- }\r
- execution.setVariable("operationStatus", resourceName )\r
-\r
- }catch(Exception e){\r
- // try error in method block\r
- String exceptionMessage = "Bpmn error encountered in "+method + "- " + e.getMessage()\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- /**\r
- * prepare check Resource Type \r
- */\r
- public void checkResourceType(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- String resourceControllerTypeDef = """[\r
- {\r
- "resourceType":"vEPC",\r
- "controllerType":"VFC"\r
- },\r
- {\r
- "resourceType":"vIMS",\r
- "controllerType":"VFC"\r
- },\r
- {\r
- "resourceType":"vCPE",\r
- "controllerType":"VFC"\r
- },\r
- {\r
- "resourceType":"vFW",\r
- "controllerType":"VFC"\r
- },\r
- {\r
- "resourceType":"Underlay",\r
- "controllerType":"SDNC"\r
- },\r
- {\r
- "resourceType":"Overlay",\r
- "controllerType":"SDNC"\r
- },\r
- {\r
- "resourceType":"VPN_SAR",\r
- "controllerType":"SDNC"\r
- },\r
- {\r
- "resourceType":"GRE_AAR",\r
- "controllerType":"APPC"\r
- },\r
- {\r
- "resourceType":"GRE_SAR",\r
- "controllerType":"SDNC"\r
- } ,\r
- {\r
- "resourceType":"APN_AAR",\r
- "controllerType":"APPC"\r
- } \r
- \r
- ]""".trim()\r
-\r
- try{\r
-\r
- String resourceName = execution.getVariable(Prefix+"resourceName") \r
- utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)\r
- execution.setVariable("resourceName", resourceName)\r
- \r
- String[] split = resourceName.split("_")\r
- \r
- utils.log("INFO", "split : " + split, isDebugEnabled)\r
- int strLen = split.size()\r
- String allottedResourceType = ""\r
- \r
- if (strLen <2) {\r
- allottedResourceType = split[0]\r
- }\r
- else {\r
- allottedResourceType = split[0] + "_" + split[1]\r
- }\r
-\r
- loadResourcesProperties(execution)\r
- String resourceControllerType= execution.getVariable("resourceControllerType") \r
- if (isBlank(resourceControllerType)) {\r
- resourceControllerType = resourceControllerTypeDef;\r
- }\r
- utils.log("INFO", "resourceControllerType: " + resourceControllerType, isDebugEnabled)\r
- \r
- List<String> ResourceTypeList = jsonUtil.StringArrayToList(execution, resourceControllerType)\r
- utils.log("INFO", "ResourceTypeList : " + ResourceTypeList, isDebugEnabled) \r
- execution.setVariable("controllerType", "Other") \r
- execution.setVariable(Prefix+"resourceType", "")\r
- for (String resourceMap : ResourceTypeList) {\r
- String resourceType = jsonUtil.getJsonValue(resourceMap, "resourceType") \r
- String controllerType = jsonUtil.getJsonValue(resourceMap, "controllerType")\r
- //utils.log("INFO", "resourceMap.resourceType : " + resourceType, isDebugEnabled)\r
- //utils.log("INFO", "resourceMap.controllerType : " + controllerType, isDebugEnabled)\r
- //utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)\r
- //utils.log("INFO", "allottedResourceType : " + allottedResourceType, isDebugEnabled )\r
- \r
- if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {\r
- execution.setVariable("controllerType", controllerType)\r
- execution.setVariable(Prefix+"resourceType", resourceType)\r
- utils.log("INFO", "found controller type : " + controllerType, isDebugEnabled)\r
- break\r
- }\r
- }\r
- utils.log("INFO", "controller Type : " + execution.getVariable("controllerType"), isDebugEnabled)\r
- utils.log("INFO", "resource Type : " + execution.getVariable(Prefix+"resourceType"), isDebugEnabled)\r
- \r
- if (execution.getVariable("controllerType") == "") {\r
- String exceptionMessage = "Resource name can not find controller type,please check the resource Name: "+ resourceName\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- if (execution.getVariable(Prefix+"resourceType") == "vCPE") {\r
- execution.setVariable("skipVFC", "false")\r
- utils.log("INFO", "vCPE will deploy ", isDebugEnabled)\r
- }\r
-\r
- }catch(Exception e){\r
- // try error in method block\r
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- /**\r
- * prepare post Unkown Resource Type \r
- */\r
- public void postOtherControllerType(DelegateExecution execution){\r
- def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- \r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postOtherControllerType Process ======== ", isDebugEnabled)\r
- try{\r
-\r
- String resourceName = execution.getVariable(Prefix+"resourceName") \r
- String resourceType = execution.getVariable(Prefix+"resourceType") \r
- String controllerType = execution.getVariable("controllerType")\r
- \r
- String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"\r
- utils.log("DEBUG", msg, isDebugEnabled)\r
- \r
- }catch(Exception e){\r
- // try error in method block\r
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()\r
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- \r
- /**\r
- * prepare Controller resource create request\r
- */\r
- public void preProcessResourceRequestForController(execution){\r
- def method = getClass().getSimpleName() + '.preProcessResourceRequestForController(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessResourceRequestForController Process ======== ", isDebugEnabled)\r
- try{\r
- String resourceName = execution.getVariable(Prefix+"resourceName") \r
- String resourceType = execution.getVariable(Prefix+"resourceType")\r
- String serviceInstanceName =execution.getVariable("serviceInstanceName") \r
- String nsServiceName = resourceType + "_" + serviceInstanceName\r
- execution.setVariable("nsServiceName", nsServiceName)\r
- utils.log("INFO", "Prepare Controller Request nsServiceName:" + nsServiceName, isDebugEnabled)\r
-\r
- String serviceId = execution.getVariable("serviceInstanceId")\r
- execution.setVariable("serviceId", serviceId)\r
- utils.log("INFO", "Prepare Controller Request serviceId:" + serviceId, isDebugEnabled) \r
- \r
- String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
- utils.log("INFO", "Prepare Controller Request globalSubscriberId:" + globalSubscriberId, isDebugEnabled) \r
- \r
- String incomingRequest = execution.getVariable("uuiRequest")\r
- String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description") \r
- execution.setVariable("nsServiceDescription", nsServiceDescription)\r
- utils.log("INFO", "Prepare Controller Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)\r
-\r
- String resourceUUID = execution.getVariable("resourceUUID")\r
- \r
- utils.log("INFO", "Prepare Controller Request resourceUUID:" + resourceUUID, isDebugEnabled)\r
- \r
- String resourceInvariantUUID = execution.getVariable("resourceInvariantUUID")\r
- utils.log("INFO", "Prepare Controller Request resourceInvariantUUID:" + resourceInvariantUUID, isDebugEnabled)\r
-\r
- String resourceParameters = execution.getVariable("resourceParameters") \r
- execution.setVariable("resourceParameters", resourceParameters)\r
- utils.log("INFO", "Prepare Controller Request resourceParameters:" + resourceParameters, isDebugEnabled)\r
-\r
-\r
-\r
- }catch(Exception e){\r
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()\r
- utils.log("ERROR", exceptionMessage, isDebugEnabled)\r
- execution.setVariable(Prefix+"ErrorResponse", exceptionMessage)\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
- /**\r
- * post process VFC resource create request\r
- */\r
- public void postProcessResourceRequestForVFC(execution){\r
- def method = getClass().getSimpleName() + '.postProcessResourceRequestForVFC(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForVFC Process ======== ", isDebugEnabled)\r
- try{\r
- \r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForVFC. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForVFC Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled) \r
- }\r
-\r
-\r
- /**\r
- * post process SDNC resource create request\r
- */\r
- public void postProcessResourceRequestForSDNC(execution){\r
- def method = getClass().getSimpleName() + '.postProcessResourceRequestForSDNC(' +'execution=' + execution.getId() +')'\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("INFO","Entered " + method, isDebugEnabled)\r
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForSDNC Process ======== ", isDebugEnabled)\r
- try{\r
- \r
- execution.setVariable("serviceSDNCCreate", "true")\r
-\r
- }catch(Exception e){\r
- utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForSDNC. Exception is:\n" + e, isDebugEnabled)\r
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForSDNC Method:\n" + e.getMessage())\r
- }\r
- utils.log("INFO", "Exited " + method, isDebugEnabled)\r
- }\r
- \r
-\r
- \r
-}\r
- \r