2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
\r
7 * ================================================================================
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
19 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.infrastructure.scripts;
\r
23 import static org.apache.commons.lang3.StringUtils.*;
\r
25 import org.apache.commons.lang3.*
\r
26 import org.camunda.bpm.engine.delegate.BpmnError
\r
27 import org.camunda.bpm.engine.delegate.DelegateExecution
\r
28 import org.json.JSONArray;
\r
29 import org.json.JSONObject;
\r
30 import org.openecomp.mso.bpmn.common.scripts.AaiUtil
\r
31 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
\r
32 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
\r
33 import org.openecomp.mso.bpmn.core.RollbackData
\r
34 import org.openecomp.mso.bpmn.core.WorkflowException
\r
35 import org.openecomp.mso.bpmn.core.json.JsonUtils
\r
36 import org.springframework.web.util.UriUtils;
\r
38 import groovy.json.*
\r
41 * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
\r
44 * @param - msoRequestId
\r
45 * @param - globalSubscriberId
\r
46 * @param - subscriptionServiceType
\r
47 * @param - serviceInstanceId
\r
48 * @param - serviceInstanceName - O
\r
49 * @param - serviceModelInfo
\r
50 * @param - productFamilyId
\r
51 * @param - disableRollback
\r
52 * @param - failExists - TODO
\r
53 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
\r
54 * @param - sdncVersion ("1610")
\r
55 * @param - serviceDecomposition - Decomposition for R1710
\r
56 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
\r
59 * @param - rollbackData (localRB->null)
\r
60 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
\r
61 * @param - WorkflowException
\r
62 * @param - serviceInstanceName - (GET from AAI if null in input)
\r
65 public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
\r
67 String Prefix="DCRESI_"
\r
68 private static final String DebugFlag = "isDebugEnabled"
\r
70 ExceptionUtil exceptionUtil = new ExceptionUtil()
\r
71 JsonUtils jsonUtil = new JsonUtils()
\r
73 public void preProcessRequest (DelegateExecution execution) {
\r
75 execution.setVariable("isDebugLogEnabled","true")
\r
76 execution.setVariable("unit_test", "true")
\r
77 execution.setVariable("skipVFC", "true")
\r
79 def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
\r
80 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
81 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
83 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRequest *****", isDebugEnabled)
\r
85 utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
\r
88 execution.setVariable("prefix", Prefix)
\r
90 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
\r
91 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
\r
92 utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
\r
94 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
\r
95 String serviceType = execution.getVariable("serviceType")
\r
96 utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
\r
98 //requestDetails.requestParameters. for SDNC assignTopology
\r
99 String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
\r
101 if (isBlank(globalSubscriberId)) {
\r
102 msg = "Input globalSubscriberId is null"
\r
103 utils.log("INFO", msg, isDebugEnabled)
\r
104 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
107 if (isBlank(serviceType)) {
\r
108 msg = "Input serviceType is null"
\r
109 utils.log("INFO", msg, isDebugEnabled)
\r
110 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
113 if (productFamilyId == null) {
\r
114 execution.setVariable("productFamilyId", "")
\r
117 String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
\r
118 if (isBlank(sdncCallbackUrl)) {
\r
119 msg = "URN_mso_workflow_sdncadapter_callback is null"
\r
120 utils.log("INFO", msg, isDebugEnabled)
\r
121 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
123 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
\r
124 utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
\r
126 //requestDetails.modelInfo.for AAI PUT servieInstanceData
\r
127 //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
\r
128 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
129 String serviceInstanceId = execution.getVariable("serviceInstanceId")
\r
130 String uuiRequest = execution.getVariable("uuiRequest")
\r
131 utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
\r
133 String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
\r
134 utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
\r
136 String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
\r
137 utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
\r
139 String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
\r
140 utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
\r
141 execution.setVariable("serviceModelName", serviceModelName)
\r
143 //aai serviceType and Role can be setted as fixed value now.
\r
144 String aaiServiceType = serviceType
\r
145 String aaiServiceRole = serviceType+"Role"
\r
147 execution.setVariable("modelInvariantUuid", modelInvariantUuid)
\r
148 execution.setVariable("modelUuid", modelUuid)
\r
151 String oStatus = execution.getVariable("initialStatus") ?: ""
\r
152 utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
\r
153 if ("TRANSPORT".equalsIgnoreCase(serviceType))
\r
155 oStatus = "Created"
\r
160 String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
\r
161 utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
\r
162 AaiUtil aaiUriUtil = new AaiUtil(this)
\r
163 utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
\r
164 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
\r
165 utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
\r
166 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
\r
167 utils.log("INFO","namespace: " + namespace, isDebugEnabled)
\r
169 String serviceInstanceData =
\r
170 """<service-instance xmlns=\"${namespace}\">
\r
171 <service-instance-id>${serviceInstanceId}</service-instance-id>
\r
172 <service-instance-name>${serviceInstanceName}</service-instance-name>
\r
173 <service-type>${aaiServiceType}</service-type>
\r
174 <service-role>${aaiServiceRole}</service-role>
\r
176 <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
\r
177 <model-version-id>${modelUuid}</model-version-id>
\r
178 </service-instance>""".trim()
\r
180 //begin only for test
\r
181 String serviceInstanceData =
\r
182 """<service-instance xmlns=\"${namespace}\">
\r
183 <service-instance-id>${serviceInstanceId}</service-instance-id>
\r
184 <service-instance-name>${serviceInstanceName}</service-instance-name>
\r
185 <service-type>${aaiServiceType}</service-type>
\r
186 <service-role>${aaiServiceRole}</service-role>
\r
188 </service-instance>""".trim()
\r
189 //end only for test
\r
190 execution.setVariable("serviceInstanceData", serviceInstanceData)
\r
191 utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
\r
192 utils.logAudit(serviceInstanceData)
\r
193 utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
\r
194 utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
\r
196 execution.setVariable("serviceSDNCCreate", "false")
\r
197 execution.setVariable("operationStatus", "Waiting deploy resource...")
\r
199 } catch (BpmnError e) {
\r
201 } catch (Exception ex){
\r
202 msg = "Exception in preProcessRequest " + ex.getMessage()
\r
203 utils.log("INFO", msg, isDebugEnabled)
\r
204 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
206 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
209 public void postProcessAAIGET(DelegateExecution execution) {
\r
210 def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'
\r
211 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
212 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
213 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET ***** ", isDebugEnabled)
\r
217 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
218 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
\r
220 utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
\r
221 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
222 utils.logAudit("workflowException: " + workflowException)
\r
223 if(workflowException != null){
\r
224 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
228 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
\r
229 utils.log("INFO", msg, isDebugEnabled)
\r
230 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
235 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
\r
237 utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
\r
238 msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
\r
239 utils.log("INFO", msg, isDebugEnabled)
\r
240 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
243 } catch (BpmnError e) {
\r
245 } catch (Exception ex) {
\r
246 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
\r
247 utils.log("INFO", msg, isDebugEnabled)
\r
248 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
250 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
253 public void postProcessAAIPUT(DelegateExecution execution) {
\r
254 def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')'
\r
255 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
256 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
257 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIPUT ***** ", isDebugEnabled)
\r
260 String serviceInstanceId = execution.getVariable("serviceInstanceId")
\r
261 boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
\r
263 utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
\r
264 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
265 utils.logAudit("workflowException: " + workflowException)
\r
266 if(workflowException != null){
\r
267 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
272 //start rollback set up
\r
273 RollbackData rollbackData = new RollbackData()
\r
274 def disableRollback = execution.getVariable("disableRollback")
\r
275 rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
\r
276 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
\r
277 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
\r
278 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
\r
279 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
\r
280 execution.setVariable("rollbackData", rollbackData)
\r
283 } catch (BpmnError e) {
\r
285 } catch (Exception ex) {
\r
286 msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
\r
287 utils.log("INFO", msg, isDebugEnabled)
\r
288 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
290 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
293 public void postProcessAAIGET2(DelegateExecution execution) {
\r
294 def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')'
\r
295 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
296 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
297 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET2 ***** ", isDebugEnabled)
\r
301 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
302 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
\r
304 utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
\r
305 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
306 utils.logAudit("workflowException: " + workflowException)
\r
307 if(workflowException != null){
\r
308 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
312 msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
\r
313 utils.log("INFO", msg, isDebugEnabled)
\r
314 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
319 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
\r
321 String aaiService = execution.getVariable("GENGS_service")
\r
322 if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
\r
323 execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
\r
324 utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
\r
328 } catch (BpmnError e) {
\r
330 } catch (Exception ex) {
\r
331 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
\r
332 utils.log("INFO", msg, isDebugEnabled)
\r
333 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
335 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
338 public void preProcessRollback (DelegateExecution execution) {
\r
339 def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')'
\r
340 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
341 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
342 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRollback ***** ", isDebugEnabled)
\r
345 Object workflowException = execution.getVariable("WorkflowException");
\r
347 if (workflowException instanceof WorkflowException) {
\r
348 utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
\r
349 execution.setVariable("prevWorkflowException", workflowException);
\r
350 //execution.setVariable("WorkflowException", null);
\r
352 } catch (BpmnError e) {
\r
353 utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
\r
354 } catch(Exception ex) {
\r
355 String msg = "Exception in preProcessRollback. " + ex.getMessage()
\r
356 utils.log("INFO", msg, isDebugEnabled)
\r
358 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
361 public void postProcessRollback (DelegateExecution execution) {
\r
362 def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')'
\r
363 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
364 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
365 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessRollback ***** ", isDebugEnabled)
\r
368 Object workflowException = execution.getVariable("prevWorkflowException");
\r
369 if (workflowException instanceof WorkflowException) {
\r
370 utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
\r
371 execution.setVariable("WorkflowException", workflowException);
\r
373 execution.setVariable("rollbackData", null)
\r
374 } catch (BpmnError b) {
\r
375 utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
\r
377 } catch(Exception ex) {
\r
378 msg = "Exception in postProcessRollback. " + ex.getMessage()
\r
379 utils.log("INFO", msg, isDebugEnabled)
\r
381 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
385 * Init the service Operation Status
\r
387 public void preUpdateServiceOperationStatus(DelegateExecution execution){
\r
388 def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
\r
389 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
390 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
393 String serviceId = execution.getVariable("serviceInstanceId")
\r
394 String operationId = execution.getVariable("operationId")
\r
395 String serviceName = execution.getVariable("serviceInstanceName")
\r
396 String operationType = "CREATE"
\r
398 String result = "processing"
\r
399 String progress = execution.getVariable("progress")
\r
400 utils.log("INFO", "progress: " + progress , isDebugEnabled)
\r
401 if ("100".equalsIgnoreCase(progress))
\r
403 result = "finished"
\r
406 String operationContent = "Prepare service creation : " + execution.getVariable("operationStatus")
\r
408 utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
\r
409 serviceId = UriUtils.encode(serviceId,"UTF-8")
\r
410 execution.setVariable("serviceInstanceId", serviceId)
\r
411 execution.setVariable("operationId", operationId)
\r
412 execution.setVariable("operationType", operationType)
\r
414 def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
\r
415 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
\r
416 utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
\r
418 execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
\r
420 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
\r
421 xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
424 <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
425 <serviceId>${serviceId}</serviceId>
\r
426 <operationId>${operationId}</operationId>
\r
427 <serviceName>${serviceName}</serviceName>
\r
428 <operationType>${operationType}</operationType>
\r
429 <userId>${userId}</userId>
\r
430 <result>${result}</result>
\r
431 <operationContent>${operationContent}</operationContent>
\r
432 <progress>${progress}</progress>
\r
433 <reason>${reason}</reason>
\r
434 </ns:updateServiceOperationStatus>
\r
436 </soapenv:Envelope>"""
\r
438 payload = utils.formatXml(payload)
\r
439 execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
\r
440 utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
\r
443 }catch(Exception e){
\r
444 utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
\r
445 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
\r
447 utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
\r
448 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
452 public void preInitResourcesOperStatus(DelegateExecution execution){
\r
453 def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
\r
454 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
455 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
457 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preInitResourcesOperStatus Process ======== ", isDebugEnabled)
\r
459 String serviceId = execution.getVariable("serviceInstanceId")
\r
460 String operationId = execution.getVariable("operationId")
\r
461 String operationType = execution.getVariable("operationType")
\r
462 String resourceTemplateUUIDs = ""
\r
463 String result = "processing"
\r
464 String progress = "0"
\r
466 String operationContent = "Prepare service creation"
\r
467 utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
\r
468 serviceId = UriUtils.encode(serviceId,"UTF-8")
\r
469 execution.setVariable("serviceInstanceId", serviceId)
\r
470 execution.setVariable("operationId", operationId)
\r
471 execution.setVariable("operationType", operationType)
\r
472 String incomingRequest = execution.getVariable("uuiRequest")
\r
473 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
474 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
475 for(String resource : resourceList){
\r
476 resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":"
\r
479 def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
\r
480 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
\r
481 utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
\r
484 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
\r
485 xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
488 <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
489 <serviceId>${serviceId}</serviceId>
\r
490 <operationId>${operationId}</operationId>
\r
491 <operationType>${operationType}</operationType>
\r
492 <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
\r
493 </ns:initResourceOperationStatus>
\r
495 </soapenv:Envelope>"""
\r
497 payload = utils.formatXml(payload)
\r
498 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
\r
499 utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
\r
500 utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
\r
502 }catch(Exception e){
\r
503 utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
\r
504 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
\r
506 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
510 * prepare resource create request
\r
512 public void preResourceRequest(execution){
\r
513 def method = getClass().getSimpleName() + '.preResourceRequest(' +'execution=' + execution.getId() +')'
\r
514 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
515 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
517 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preResourceRequest Process ======== ", isDebugEnabled)
\r
519 String resourceType = execution.getVariable("resourceType")
\r
520 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
521 String nsServiceName = resourceType + "_" + serviceInstanceName
\r
522 execution.setVariable("nsServiceName", nsServiceName)
\r
523 utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
\r
524 String globalSubscriberId = execution.getVariable("globalSubscriberId")
\r
525 String serviceType = execution.getVariable("serviceType")
\r
526 String serviceId = execution.getVariable("serviceInstanceId")
\r
527 execution.setVariable("serviceId", serviceId)
\r
528 String operationId = execution.getVariable("operationId")
\r
529 String incomingRequest = execution.getVariable("uuiRequest")
\r
530 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
531 String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
\r
532 execution.setVariable("nsServiceDescription", nsServiceDescription)
\r
533 utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
\r
534 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
535 for(String resource : resourceList){
\r
536 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
537 if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
\r
538 String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
\r
539 String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
\r
540 String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
\r
541 execution.setVariable("resourceUUID", resourceUUID)
\r
542 execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
\r
543 execution.setVariable("resourceParameters", resourceParameters)
\r
544 utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
\r
545 utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
\r
546 utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
\r
549 } catch (BpmnError b) {
\r
550 utils.log("INFO", "BPMN Error during preResourceRequest", isDebugEnabled)
\r
552 } catch(Exception ex) {
\r
553 msg = "Exception in preResourceRequest. " + ex.getMessage()
\r
554 utils.log("INFO", msg, isDebugEnabled)
\r
556 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
560 * post config request.
\r
562 public void postConfigRequest(execution){
\r
566 /***********************************************************************************************/
\r
568 private void loadResourcesProperties(DelegateExecution execution) {
\r
569 def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
\r
570 def isDebugEnabled = execution.getVariable("isDebugEnabled")
\r
571 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
572 String loadFilePath = "/etc/mso/config.d/reources.json"
\r
574 def jsonPayload = new File(loadFilePath).text
\r
575 utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)
\r
577 String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
\r
578 utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)
\r
580 String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
\r
581 //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)
\r
582 execution.setVariable("createResourceSort", createResourceSort)
\r
584 String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
\r
585 //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)
\r
586 execution.setVariable("deleteResourceSort", deleteResourceSort)
\r
589 String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
\r
590 //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)
\r
591 execution.setVariable("resourceControllerType", resourceControllerType)
\r
594 }catch(Exception ex){
\r
595 // try error in method block
\r
596 String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
\r
597 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
598 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
600 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
602 private sortCreateResource(DelegateExecution execution) {
\r
603 def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')'
\r
604 def isDebugEnabled = execution.getVariable("isDebugEnabled")
\r
605 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
606 String createResourceSortDef = """[
\r
608 "resourceType":"vEPC"
\r
611 "resourceType":"vIMS"
\r
614 "resourceType":"vCPE"
\r
617 "resourceType":"vFW"
\r
620 "resourceType":"Underlay"
\r
623 "resourceType":"Overlay"
\r
626 "resourceType":"GRE_AAR"
\r
629 "resourceType":"APN_AAR"
\r
632 "resourceType":"VPN_SAR"
\r
635 "resourceType":"GRE_SAR"
\r
642 loadResourcesProperties(execution)
\r
643 String createResourceSort = execution.getVariable("createResourceSort")
\r
644 if (isBlank(createResourceSort)) {
\r
645 createResourceSort = createResourceSortDef;
\r
648 List<String> sortResourceList = jsonUtil.StringArrayToList(execution, createResourceSort)
\r
649 utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled)
\r
651 JSONArray newResourceList = new JSONArray()
\r
652 int resSortCount = sortResourceList.size()
\r
655 for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
\r
656 String sortResource = sortResourceList[currentResource]
\r
657 String resourceType = jsonUtil.getJsonValue(sortResource, "resourceType")
\r
658 List<String> resourceList = execution.getVariable(Prefix+"resourceList")
\r
660 for (String resource : resourceList) {
\r
661 //utils.log("INFO", "resource : " + resource, isDebugEnabled)
\r
662 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
663 //utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
\r
664 String[] split = resourceName.split("_")
\r
666 utils.log("INFO", "split : " + split, isDebugEnabled)
\r
667 int strLen = split.size()
\r
668 String allottedResourceType = ""
\r
671 allottedResourceType = split[0]
\r
674 allottedResourceType = split[0] + "_" + split[1]
\r
677 if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
\r
678 utils.log("INFO", "allottedResourceType : " + allottedResourceType + " resourceType : " + resourceType, isDebugEnabled)
\r
679 utils.log("INFO", "resource : " + resource , isDebugEnabled)
\r
680 JSONObject jsonObj = new JSONObject(resource)
\r
681 newResourceList.put(jsonObj)
\r
684 utils.log("INFO", "Get next sort type " , isDebugEnabled)
\r
687 utils.log("INFO", "newResourceList : " + newResourceList, isDebugEnabled)
\r
688 String newResourceStr = newResourceList.toString()
\r
689 List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
\r
691 execution.setVariable(Prefix+"resourceList", newResourceListStr)
\r
692 utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled)
\r
694 }catch(Exception ex){
\r
695 // try error in method block
\r
696 String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
\r
697 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
698 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
700 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
704 * get service resources
\r
706 public void getServiceResources(DelegateExecution execution){
\r
707 def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')'
\r
708 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
709 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
710 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 getServiceResources Process ======== ", isDebugEnabled)
\r
712 execution.setVariable(Prefix+"resourceCount", 0)
\r
713 execution.setVariable(Prefix+"nextResource", 0)
\r
715 String incomingRequest = execution.getVariable("uuiRequest")
\r
716 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
717 utils.log("INFO", "Resources String : " + resourcesStr, isDebugEnabled)
\r
718 if (!isBlank(resourcesStr)) {
\r
719 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
720 utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
\r
721 execution.setVariable(Prefix+"resourceList", resourceList)
\r
722 execution.setVariable(Prefix+"resourceCount", resourceList.size())
\r
723 execution.setVariable(Prefix+"nextResource", 0)
\r
726 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
727 utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
729 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
730 utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
\r
732 if (resourceNum < resourceCount) {
\r
733 execution.setVariable(Prefix+"resourceFinish", false)
\r
736 execution.setVariable(Prefix+"resourceFinish", true)
\r
738 sortCreateResource(execution)
\r
740 }catch(Exception e){
\r
741 utils.log("ERROR", "Exception Occured Processing getServiceResources. Exception is:\n" + e, isDebugEnabled)
\r
742 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during getServiceResources Method:\n" + e.getMessage())
\r
744 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
748 * prepare Decompose next resource to create request
\r
750 public void preProcessDecomposeNextResource(DelegateExecution execution){
\r
751 def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
\r
752 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
753 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
754 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessDecomposeNextResource Process ======== ", isDebugEnabled)
\r
756 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
757 List<String> resourceList = execution.getVariable(Prefix+"resourceList")
\r
758 utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
\r
760 String resource = resourceList[resourceNum]
\r
761 execution.setVariable(Prefix+"resource", resource)
\r
762 utils.log("INFO", "Current Resource : " + resource, isDebugEnabled)
\r
764 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
765 execution.setVariable(Prefix+"resourceName", resourceName)
\r
766 utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
\r
768 String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
\r
769 execution.setVariable("resourceUUID", resourceUUID)
\r
770 utils.log("INFO", "resource UUID : " + resourceUUID, isDebugEnabled)
\r
772 String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
\r
773 execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
\r
776 String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
\r
777 execution.setVariable("resourceParameters", resourceParameters)
\r
778 utils.log("INFO", "resource Parameters : " + resourceParameters, isDebugEnabled)
\r
780 execution.setVariable(Prefix+"nextResource", resourceNum + 1)
\r
781 utils.log("INFO", "next Resource num : " + execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
783 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
784 if (resourceCount >0 ){
\r
785 int progress = (resourceNum*100) / resourceCount
\r
786 execution.setVariable("progress", progress.toString() )
\r
789 execution.setVariable("operationStatus", resourceName )
\r
791 }catch(Exception e){
\r
792 utils.log("ERROR", "Exception Occured Processing preProcessDecomposeNextResource. Exception is:\n" + e, isDebugEnabled)
\r
793 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during preProcessDecomposeNextResource Method:\n" + e.getMessage())
\r
795 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
798 * post Decompose next resource to create request
\r
800 public void postProcessDecomposeNextResource(DelegateExecution execution){
\r
801 def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
\r
802 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
803 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
804 utils.log("INFO", " ======== STARTED DoCreateE2EServiceInstanceV2 postProcessDecomposeNextResource Process ======== ", isDebugEnabled)
\r
806 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
808 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
809 utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
811 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
812 utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
\r
814 if (resourceNum < resourceCount) {
\r
815 execution.setVariable(Prefix+"resourceFinish", false)
\r
818 execution.setVariable(Prefix+"resourceFinish", true)
\r
821 utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)
\r
823 if (resourceCount >0 ){
\r
824 int progress = (resourceNum*100) / resourceCount
\r
825 execution.setVariable("progress", progress.toString() )
\r
826 utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)
\r
828 execution.setVariable("operationStatus", resourceName )
\r
830 }catch(Exception e){
\r
831 // try error in method block
\r
832 String exceptionMessage = "Bpmn error encountered in "+method + "- " + e.getMessage()
\r
833 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
834 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
836 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
839 * prepare check Resource Type
\r
841 public void checkResourceType(DelegateExecution execution){
\r
842 def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')'
\r
843 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
844 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
845 String resourceControllerTypeDef = """[
\r
847 "resourceType":"vEPC",
\r
848 "controllerType":"VFC"
\r
851 "resourceType":"vIMS",
\r
852 "controllerType":"VFC"
\r
855 "resourceType":"vCPE",
\r
856 "controllerType":"VFC"
\r
859 "resourceType":"vFW",
\r
860 "controllerType":"VFC"
\r
863 "resourceType":"Underlay",
\r
864 "controllerType":"SDNC"
\r
867 "resourceType":"Overlay",
\r
868 "controllerType":"SDNC"
\r
871 "resourceType":"VPN_SAR",
\r
872 "controllerType":"SDNC"
\r
875 "resourceType":"GRE_AAR",
\r
876 "controllerType":"APPC"
\r
879 "resourceType":"GRE_SAR",
\r
880 "controllerType":"SDNC"
\r
883 "resourceType":"APN_AAR",
\r
884 "controllerType":"APPC"
\r
891 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
892 utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
\r
893 execution.setVariable("resourceName", resourceName)
\r
895 String[] split = resourceName.split("_")
\r
897 utils.log("INFO", "split : " + split, isDebugEnabled)
\r
898 int strLen = split.size()
\r
899 String allottedResourceType = ""
\r
902 allottedResourceType = split[0]
\r
905 allottedResourceType = split[0] + "_" + split[1]
\r
908 loadResourcesProperties(execution)
\r
909 String resourceControllerType= execution.getVariable("resourceControllerType")
\r
910 if (isBlank(resourceControllerType)) {
\r
911 resourceControllerType = resourceControllerTypeDef;
\r
913 utils.log("INFO", "resourceControllerType: " + resourceControllerType, isDebugEnabled)
\r
915 List<String> ResourceTypeList = jsonUtil.StringArrayToList(execution, resourceControllerType)
\r
916 utils.log("INFO", "ResourceTypeList : " + ResourceTypeList, isDebugEnabled)
\r
917 execution.setVariable("controllerType", "Other")
\r
918 execution.setVariable(Prefix+"resourceType", "")
\r
919 for (String resourceMap : ResourceTypeList) {
\r
920 String resourceType = jsonUtil.getJsonValue(resourceMap, "resourceType")
\r
921 String controllerType = jsonUtil.getJsonValue(resourceMap, "controllerType")
\r
922 //utils.log("INFO", "resourceMap.resourceType : " + resourceType, isDebugEnabled)
\r
923 //utils.log("INFO", "resourceMap.controllerType : " + controllerType, isDebugEnabled)
\r
924 //utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
\r
925 //utils.log("INFO", "allottedResourceType : " + allottedResourceType, isDebugEnabled )
\r
927 if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
\r
928 execution.setVariable("controllerType", controllerType)
\r
929 execution.setVariable(Prefix+"resourceType", resourceType)
\r
930 utils.log("INFO", "found controller type : " + controllerType, isDebugEnabled)
\r
934 utils.log("INFO", "controller Type : " + execution.getVariable("controllerType"), isDebugEnabled)
\r
935 utils.log("INFO", "resource Type : " + execution.getVariable(Prefix+"resourceType"), isDebugEnabled)
\r
937 if (execution.getVariable("controllerType") == "") {
\r
938 String exceptionMessage = "Resource name can not find controller type,please check the resource Name: "+ resourceName
\r
939 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
940 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
942 if (execution.getVariable(Prefix+"resourceType") == "vCPE") {
\r
943 execution.setVariable("skipVFC", "false")
\r
944 utils.log("INFO", "vCPE will deploy ", isDebugEnabled)
\r
947 }catch(Exception e){
\r
948 // try error in method block
\r
949 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
950 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
951 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
953 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
956 * prepare post Unkown Resource Type
\r
958 public void postOtherControllerType(DelegateExecution execution){
\r
959 def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
\r
960 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
961 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
963 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postOtherControllerType Process ======== ", isDebugEnabled)
\r
966 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
967 String resourceType = execution.getVariable(Prefix+"resourceType")
\r
968 String controllerType = execution.getVariable("controllerType")
\r
970 String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
\r
971 utils.log("DEBUG", msg, isDebugEnabled)
\r
973 }catch(Exception e){
\r
974 // try error in method block
\r
975 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
976 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
977 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
979 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
983 * prepare Controller resource create request
\r
985 public void preProcessResourceRequestForController(execution){
\r
986 def method = getClass().getSimpleName() + '.preProcessResourceRequestForController(' +'execution=' + execution.getId() +')'
\r
987 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
988 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
989 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessResourceRequestForController Process ======== ", isDebugEnabled)
\r
991 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
992 String resourceType = execution.getVariable(Prefix+"resourceType")
\r
993 String serviceInstanceName =execution.getVariable("serviceInstanceName")
\r
994 String nsServiceName = resourceType + "_" + serviceInstanceName
\r
995 execution.setVariable("nsServiceName", nsServiceName)
\r
996 utils.log("INFO", "Prepare Controller Request nsServiceName:" + nsServiceName, isDebugEnabled)
\r
998 String serviceId = execution.getVariable("serviceInstanceId")
\r
999 execution.setVariable("serviceId", serviceId)
\r
1000 utils.log("INFO", "Prepare Controller Request serviceId:" + serviceId, isDebugEnabled)
\r
1002 String globalSubscriberId = execution.getVariable("globalSubscriberId")
\r
1003 utils.log("INFO", "Prepare Controller Request globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
\r
1005 String incomingRequest = execution.getVariable("uuiRequest")
\r
1006 String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
\r
1007 execution.setVariable("nsServiceDescription", nsServiceDescription)
\r
1008 utils.log("INFO", "Prepare Controller Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
\r
1010 String resourceUUID = execution.getVariable("resourceUUID")
\r
1012 utils.log("INFO", "Prepare Controller Request resourceUUID:" + resourceUUID, isDebugEnabled)
\r
1014 String resourceInvariantUUID = execution.getVariable("resourceInvariantUUID")
\r
1015 utils.log("INFO", "Prepare Controller Request resourceInvariantUUID:" + resourceInvariantUUID, isDebugEnabled)
\r
1017 String resourceParameters = execution.getVariable("resourceParameters")
\r
1018 execution.setVariable("resourceParameters", resourceParameters)
\r
1019 utils.log("INFO", "Prepare Controller Request resourceParameters:" + resourceParameters, isDebugEnabled)
\r
1023 }catch(Exception e){
\r
1024 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
1025 utils.log("ERROR", exceptionMessage, isDebugEnabled)
\r
1026 execution.setVariable(Prefix+"ErrorResponse", exceptionMessage)
\r
1028 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
1031 * post process VFC resource create request
\r
1033 public void postProcessResourceRequestForVFC(execution){
\r
1034 def method = getClass().getSimpleName() + '.postProcessResourceRequestForVFC(' +'execution=' + execution.getId() +')'
\r
1035 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
1036 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
1037 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForVFC Process ======== ", isDebugEnabled)
\r
1041 }catch(Exception e){
\r
1042 utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForVFC. Exception is:\n" + e, isDebugEnabled)
\r
1043 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForVFC Method:\n" + e.getMessage())
\r
1045 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
1050 * post process SDNC resource create request
\r
1052 public void postProcessResourceRequestForSDNC(execution){
\r
1053 def method = getClass().getSimpleName() + '.postProcessResourceRequestForSDNC(' +'execution=' + execution.getId() +')'
\r
1054 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
1055 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
1056 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForSDNC Process ======== ", isDebugEnabled)
\r
1059 execution.setVariable("serviceSDNCCreate", "true")
\r
1061 }catch(Exception e){
\r
1062 utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForSDNC. Exception is:\n" + e, isDebugEnabled)
\r
1063 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForSDNC Method:\n" + e.getMessage())
\r
1065 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r