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
24 import groovy.xml.XmlUtil
\r
25 import groovy.json.*
\r
27 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
\r
28 import org.openecomp.mso.bpmn.core.domain.ServiceInstance
\r
29 import org.openecomp.mso.bpmn.core.domain.ModelInfo
\r
30 import org.openecomp.mso.bpmn.core.json.JsonUtils
\r
31 import org.openecomp.mso.bpmn.common.scripts.AaiUtil
\r
32 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
\r
33 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
\r
34 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
\r
35 import org.openecomp.mso.bpmn.core.RollbackData
\r
36 import org.openecomp.mso.bpmn.core.WorkflowException
\r
37 import org.openecomp.mso.rest.APIResponse;
\r
38 import org.openecomp.mso.rest.RESTClient
\r
39 import org.openecomp.mso.rest.RESTConfig
\r
41 import java.util.UUID;
\r
43 import org.camunda.bpm.engine.delegate.BpmnError
\r
44 import org.camunda.bpm.engine.runtime.Execution
\r
45 import org.json.JSONObject;
\r
46 import org.json.JSONArray;
\r
47 import org.apache.commons.lang3.*
\r
48 import org.apache.commons.codec.binary.Base64;
\r
49 import org.springframework.web.util.UriUtils;
\r
52 * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
\r
55 * @param - msoRequestId
\r
56 * @param - globalSubscriberId
\r
57 * @param - subscriptionServiceType
\r
58 * @param - serviceInstanceId
\r
59 * @param - serviceInstanceName - O
\r
60 * @param - serviceModelInfo
\r
61 * @param - productFamilyId
\r
62 * @param - disableRollback
\r
63 * @param - failExists - TODO
\r
64 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
\r
65 * @param - sdncVersion ("1610")
\r
66 * @param - serviceDecomposition - Decomposition for R1710
\r
67 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
\r
70 * @param - rollbackData (localRB->null)
\r
71 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
\r
72 * @param - WorkflowException
\r
73 * @param - serviceInstanceName - (GET from AAI if null in input)
\r
76 public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
\r
78 String Prefix="DCRESI_"
\r
79 private static final String DebugFlag = "isDebugEnabled"
\r
81 ExceptionUtil exceptionUtil = new ExceptionUtil()
\r
82 JsonUtils jsonUtil = new JsonUtils()
\r
84 public void preProcessRequest (Execution execution) {
\r
86 execution.setVariable("isDebugLogEnabled","true")
\r
87 execution.setVariable("unit_test", "true")
\r
88 execution.setVariable("skipVFC", "true")
\r
90 def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
\r
91 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
92 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
94 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRequest *****", isDebugEnabled)
\r
96 utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
\r
99 execution.setVariable("prefix", Prefix)
\r
101 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
\r
102 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
\r
103 utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
\r
105 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
\r
106 String serviceType = execution.getVariable("serviceType")
\r
107 utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
\r
109 //requestDetails.requestParameters. for SDNC assignTopology
\r
110 String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
\r
112 if (isBlank(globalSubscriberId)) {
\r
113 msg = "Input globalSubscriberId is null"
\r
114 utils.log("INFO", msg, isDebugEnabled)
\r
115 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
118 if (isBlank(serviceType)) {
\r
119 msg = "Input serviceType is null"
\r
120 utils.log("INFO", msg, isDebugEnabled)
\r
121 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
124 if (productFamilyId == null) {
\r
125 execution.setVariable("productFamilyId", "")
\r
128 String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
\r
129 if (isBlank(sdncCallbackUrl)) {
\r
130 msg = "URN_mso_workflow_sdncadapter_callback is null"
\r
131 utils.log("INFO", msg, isDebugEnabled)
\r
132 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
\r
134 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
\r
135 utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
\r
137 //requestDetails.modelInfo.for AAI PUT servieInstanceData
\r
138 //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
\r
139 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
140 String serviceInstanceId = execution.getVariable("serviceInstanceId")
\r
141 String uuiRequest = execution.getVariable("uuiRequest")
\r
142 utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
\r
144 String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
\r
145 utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
\r
147 String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
\r
148 utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
\r
150 String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
\r
151 utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
\r
152 execution.setVariable("serviceModelName", serviceModelName)
\r
154 //aai serviceType and Role can be setted as fixed value now.
\r
155 String aaiServiceType = serviceType
\r
156 String aaiServiceRole = serviceType+"Role"
\r
158 execution.setVariable("modelInvariantUuid", modelInvariantUuid)
\r
159 execution.setVariable("modelUuid", modelUuid)
\r
162 String oStatus = execution.getVariable("initialStatus") ?: ""
\r
163 utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
\r
164 if ("TRANSPORT".equalsIgnoreCase(serviceType))
\r
166 oStatus = "Created"
\r
171 String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
\r
172 utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
\r
173 AaiUtil aaiUriUtil = new AaiUtil(this)
\r
174 utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
\r
175 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
\r
176 utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
\r
177 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
\r
178 utils.log("INFO","namespace: " + namespace, isDebugEnabled)
\r
180 String serviceInstanceData =
\r
181 """<service-instance xmlns=\"${namespace}\">
\r
182 <service-instance-id>${serviceInstanceId}</service-instance-id>
\r
183 <service-instance-name>${serviceInstanceName}</service-instance-name>
\r
184 <service-type>${aaiServiceType}</service-type>
\r
185 <service-role>${aaiServiceRole}</service-role>
\r
187 <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
\r
188 <model-version-id>${modelUuid}</model-version-id>
\r
189 </service-instance>""".trim()
\r
191 //begin only for test
\r
192 String serviceInstanceData =
\r
193 """<service-instance xmlns=\"${namespace}\">
\r
194 <service-instance-id>${serviceInstanceId}</service-instance-id>
\r
195 <service-instance-name>${serviceInstanceName}</service-instance-name>
\r
196 <service-type>${aaiServiceType}</service-type>
\r
197 <service-role>${aaiServiceRole}</service-role>
\r
199 </service-instance>""".trim()
\r
200 //end only for test
\r
201 execution.setVariable("serviceInstanceData", serviceInstanceData)
\r
202 utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
\r
203 utils.logAudit(serviceInstanceData)
\r
204 utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
\r
205 utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
\r
207 execution.setVariable("serviceSDNCCreate", "false")
\r
208 execution.setVariable("operationStatus", "Waiting deploy resource...")
\r
210 } catch (BpmnError e) {
\r
212 } catch (Exception ex){
\r
213 msg = "Exception in preProcessRequest " + ex.getMessage()
\r
214 utils.log("INFO", msg, isDebugEnabled)
\r
215 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
217 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
220 public void postProcessAAIGET(Execution execution) {
\r
221 def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'
\r
222 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
223 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
224 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET ***** ", isDebugEnabled)
\r
228 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
229 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
\r
231 utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
\r
232 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
233 utils.logAudit("workflowException: " + workflowException)
\r
234 if(workflowException != null){
\r
235 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
239 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
\r
240 utils.log("INFO", msg, isDebugEnabled)
\r
241 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
246 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
\r
248 utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
\r
249 msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
\r
250 utils.log("INFO", msg, isDebugEnabled)
\r
251 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
254 } catch (BpmnError e) {
\r
256 } catch (Exception ex) {
\r
257 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
\r
258 utils.log("INFO", msg, isDebugEnabled)
\r
259 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
261 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
264 public void postProcessAAIPUT(Execution execution) {
\r
265 def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')'
\r
266 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
267 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
268 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIPUT ***** ", isDebugEnabled)
\r
271 String serviceInstanceId = execution.getVariable("serviceInstanceId")
\r
272 boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
\r
274 utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
\r
275 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
276 utils.logAudit("workflowException: " + workflowException)
\r
277 if(workflowException != null){
\r
278 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
283 //start rollback set up
\r
284 RollbackData rollbackData = new RollbackData()
\r
285 def disableRollback = execution.getVariable("disableRollback")
\r
286 rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
\r
287 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
\r
288 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
\r
289 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
\r
290 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
\r
291 execution.setVariable("rollbackData", rollbackData)
\r
294 } catch (BpmnError e) {
\r
296 } catch (Exception ex) {
\r
297 msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
\r
298 utils.log("INFO", msg, isDebugEnabled)
\r
299 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
301 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
304 public void postProcessAAIGET2(Execution execution) {
\r
305 def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')'
\r
306 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
307 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
308 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET2 ***** ", isDebugEnabled)
\r
312 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
313 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
\r
315 utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
\r
316 WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
317 utils.logAudit("workflowException: " + workflowException)
\r
318 if(workflowException != null){
\r
319 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
\r
323 msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
\r
324 utils.log("INFO", msg, isDebugEnabled)
\r
325 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
\r
330 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
\r
332 String aaiService = execution.getVariable("GENGS_service")
\r
333 if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
\r
334 execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
\r
335 utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
\r
339 } catch (BpmnError e) {
\r
341 } catch (Exception ex) {
\r
342 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
\r
343 utils.log("INFO", msg, isDebugEnabled)
\r
344 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
\r
346 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
349 public void preProcessRollback (Execution execution) {
\r
350 def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')'
\r
351 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
352 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
353 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRollback ***** ", isDebugEnabled)
\r
356 Object workflowException = execution.getVariable("WorkflowException");
\r
358 if (workflowException instanceof WorkflowException) {
\r
359 utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
\r
360 execution.setVariable("prevWorkflowException", workflowException);
\r
361 //execution.setVariable("WorkflowException", null);
\r
363 } catch (BpmnError e) {
\r
364 utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
\r
365 } catch(Exception ex) {
\r
366 String msg = "Exception in preProcessRollback. " + ex.getMessage()
\r
367 utils.log("INFO", msg, isDebugEnabled)
\r
369 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
372 public void postProcessRollback (Execution execution) {
\r
373 def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')'
\r
374 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
375 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
376 utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessRollback ***** ", isDebugEnabled)
\r
379 Object workflowException = execution.getVariable("prevWorkflowException");
\r
380 if (workflowException instanceof WorkflowException) {
\r
381 utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
\r
382 execution.setVariable("WorkflowException", workflowException);
\r
384 execution.setVariable("rollbackData", null)
\r
385 } catch (BpmnError b) {
\r
386 utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
\r
388 } catch(Exception ex) {
\r
389 msg = "Exception in postProcessRollback. " + ex.getMessage()
\r
390 utils.log("INFO", msg, isDebugEnabled)
\r
392 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
396 * Init the service Operation Status
\r
398 public void preUpdateServiceOperationStatus(Execution execution){
\r
399 def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
\r
400 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
401 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
404 String serviceId = execution.getVariable("serviceInstanceId")
\r
405 String operationId = execution.getVariable("operationId")
\r
406 String serviceName = execution.getVariable("serviceInstanceName")
\r
407 String operationType = "CREATE"
\r
409 String result = "processing"
\r
410 String progress = execution.getVariable("progress")
\r
411 utils.log("INFO", "progress: " + progress , isDebugEnabled)
\r
412 if ("100".equalsIgnoreCase(progress))
\r
414 result = "finished"
\r
417 String operationContent = "Prepare service creation : " + execution.getVariable("operationStatus")
\r
419 utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
\r
420 serviceId = UriUtils.encode(serviceId,"UTF-8")
\r
421 execution.setVariable("serviceInstanceId", serviceId)
\r
422 execution.setVariable("operationId", operationId)
\r
423 execution.setVariable("operationType", operationType)
\r
425 def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
\r
426 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
\r
427 utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
\r
429 execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
\r
431 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
\r
432 xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
435 <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
436 <serviceId>${serviceId}</serviceId>
\r
437 <operationId>${operationId}</operationId>
\r
438 <serviceName>${serviceName}</serviceName>
\r
439 <operationType>${operationType}</operationType>
\r
440 <userId>${userId}</userId>
\r
441 <result>${result}</result>
\r
442 <operationContent>${operationContent}</operationContent>
\r
443 <progress>${progress}</progress>
\r
444 <reason>${reason}</reason>
\r
445 </ns:updateServiceOperationStatus>
\r
447 </soapenv:Envelope>"""
\r
449 payload = utils.formatXml(payload)
\r
450 execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
\r
451 utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
\r
454 }catch(Exception e){
\r
455 utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
\r
456 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
\r
458 utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
\r
459 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
463 public void preInitResourcesOperStatus(Execution execution){
\r
464 def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
\r
465 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
466 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
468 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preInitResourcesOperStatus Process ======== ", isDebugEnabled)
\r
470 String serviceId = execution.getVariable("serviceInstanceId")
\r
471 String operationId = execution.getVariable("operationId")
\r
472 String operationType = execution.getVariable("operationType")
\r
473 String resourceTemplateUUIDs = ""
\r
474 String result = "processing"
\r
475 String progress = "0"
\r
477 String operationContent = "Prepare service creation"
\r
478 utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
\r
479 serviceId = UriUtils.encode(serviceId,"UTF-8")
\r
480 execution.setVariable("serviceInstanceId", serviceId)
\r
481 execution.setVariable("operationId", operationId)
\r
482 execution.setVariable("operationType", operationType)
\r
483 String incomingRequest = execution.getVariable("uuiRequest")
\r
484 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
485 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
486 for(String resource : resourceList){
\r
487 resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":"
\r
490 def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
\r
491 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
\r
492 utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
\r
495 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
\r
496 xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
499 <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
500 <serviceId>${serviceId}</serviceId>
\r
501 <operationId>${operationId}</operationId>
\r
502 <operationType>${operationType}</operationType>
\r
503 <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
\r
504 </ns:initResourceOperationStatus>
\r
506 </soapenv:Envelope>"""
\r
508 payload = utils.formatXml(payload)
\r
509 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
\r
510 utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
\r
511 utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
\r
513 }catch(Exception e){
\r
514 utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
\r
515 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
\r
517 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
521 * prepare resource create request
\r
523 public void preResourceRequest(execution){
\r
524 def method = getClass().getSimpleName() + '.preResourceRequest(' +'execution=' + execution.getId() +')'
\r
525 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
526 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
528 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preResourceRequest Process ======== ", isDebugEnabled)
\r
530 String resourceType = execution.getVariable("resourceType")
\r
531 String serviceInstanceName = execution.getVariable("serviceInstanceName")
\r
532 String nsServiceName = resourceType + "_" + serviceInstanceName
\r
533 execution.setVariable("nsServiceName", nsServiceName)
\r
534 utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
\r
535 String globalSubscriberId = execution.getVariable("globalSubscriberId")
\r
536 String serviceType = execution.getVariable("serviceType")
\r
537 String serviceId = execution.getVariable("serviceInstanceId")
\r
538 execution.setVariable("serviceId", serviceId)
\r
539 String operationId = execution.getVariable("operationId")
\r
540 String incomingRequest = execution.getVariable("uuiRequest")
\r
541 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
542 String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
\r
543 execution.setVariable("nsServiceDescription", nsServiceDescription)
\r
544 utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
\r
545 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
546 for(String resource : resourceList){
\r
547 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
548 if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
\r
549 String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
\r
550 String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
\r
551 String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
\r
552 execution.setVariable("resourceUUID", resourceUUID)
\r
553 execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
\r
554 execution.setVariable("resourceParameters", resourceParameters)
\r
555 utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
\r
556 utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
\r
557 utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
\r
560 } catch (BpmnError b) {
\r
561 utils.log("INFO", "BPMN Error during preResourceRequest", isDebugEnabled)
\r
563 } catch(Exception ex) {
\r
564 msg = "Exception in preResourceRequest. " + ex.getMessage()
\r
565 utils.log("INFO", msg, isDebugEnabled)
\r
567 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
571 * post config request.
\r
573 public void postConfigRequest(execution){
\r
577 /***********************************************************************************************/
\r
579 private void loadResourcesProperties(Execution execution) {
\r
580 def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
\r
581 def isDebugEnabled = execution.getVariable("isDebugEnabled")
\r
582 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
583 String loadFilePath = "/etc/mso/config.d/reources.json"
\r
585 def jsonPayload = new File(loadFilePath).text
\r
586 utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)
\r
588 String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
\r
589 utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)
\r
591 String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
\r
592 //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)
\r
593 execution.setVariable("createResourceSort", createResourceSort)
\r
595 String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
\r
596 //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)
\r
597 execution.setVariable("deleteResourceSort", deleteResourceSort)
\r
600 String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
\r
601 //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)
\r
602 execution.setVariable("resourceControllerType", resourceControllerType)
\r
605 }catch(Exception ex){
\r
606 // try error in method block
\r
607 String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
\r
608 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
609 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
611 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
613 private sortCreateResource(Execution execution) {
\r
614 def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')'
\r
615 def isDebugEnabled = execution.getVariable("isDebugEnabled")
\r
616 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
617 String createResourceSortDef = """[
\r
619 "resourceType":"vEPC"
\r
622 "resourceType":"vIMS"
\r
625 "resourceType":"vCPE"
\r
628 "resourceType":"vFW"
\r
631 "resourceType":"Underlay"
\r
634 "resourceType":"Overlay"
\r
637 "resourceType":"GRE_AAR"
\r
640 "resourceType":"APN_AAR"
\r
643 "resourceType":"VPN_SAR"
\r
646 "resourceType":"GRE_SAR"
\r
653 loadResourcesProperties(execution)
\r
654 String createResourceSort = execution.getVariable("createResourceSort")
\r
655 if (isBlank(createResourceSort)) {
\r
656 createResourceSort = createResourceSortDef;
\r
659 List<String> sortResourceList = jsonUtil.StringArrayToList(execution, createResourceSort)
\r
660 utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled)
\r
662 JSONArray newResourceList = new JSONArray()
\r
663 int resSortCount = sortResourceList.size()
\r
666 for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
\r
667 String sortResource = sortResourceList[currentResource]
\r
668 String resourceType = jsonUtil.getJsonValue(sortResource, "resourceType")
\r
669 List<String> resourceList = execution.getVariable(Prefix+"resourceList")
\r
671 for (String resource : resourceList) {
\r
672 //utils.log("INFO", "resource : " + resource, isDebugEnabled)
\r
673 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
674 //utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
\r
675 String[] split = resourceName.split("_")
\r
677 utils.log("INFO", "split : " + split, isDebugEnabled)
\r
678 int strLen = split.size()
\r
679 String allottedResourceType = ""
\r
682 allottedResourceType = split[0]
\r
685 allottedResourceType = split[0] + "_" + split[1]
\r
688 if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
\r
689 utils.log("INFO", "allottedResourceType : " + allottedResourceType + " resourceType : " + resourceType, isDebugEnabled)
\r
690 utils.log("INFO", "resource : " + resource , isDebugEnabled)
\r
691 JSONObject jsonObj = new JSONObject(resource)
\r
692 newResourceList.put(jsonObj)
\r
695 utils.log("INFO", "Get next sort type " , isDebugEnabled)
\r
698 utils.log("INFO", "newResourceList : " + newResourceList, isDebugEnabled)
\r
699 String newResourceStr = newResourceList.toString()
\r
700 List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
\r
702 execution.setVariable(Prefix+"resourceList", newResourceListStr)
\r
703 utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled)
\r
705 }catch(Exception ex){
\r
706 // try error in method block
\r
707 String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
\r
708 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
709 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
711 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
715 * get service resources
\r
717 public void getServiceResources(Execution execution){
\r
718 def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')'
\r
719 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
720 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
721 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 getServiceResources Process ======== ", isDebugEnabled)
\r
723 execution.setVariable(Prefix+"resourceCount", 0)
\r
724 execution.setVariable(Prefix+"nextResource", 0)
\r
726 String incomingRequest = execution.getVariable("uuiRequest")
\r
727 String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
\r
728 utils.log("INFO", "Resources String : " + resourcesStr, isDebugEnabled)
\r
729 if (!isBlank(resourcesStr)) {
\r
730 List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
\r
731 utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
\r
732 execution.setVariable(Prefix+"resourceList", resourceList)
\r
733 execution.setVariable(Prefix+"resourceCount", resourceList.size())
\r
734 execution.setVariable(Prefix+"nextResource", 0)
\r
737 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
738 utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
740 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
741 utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
\r
743 if (resourceNum < resourceCount) {
\r
744 execution.setVariable(Prefix+"resourceFinish", false)
\r
747 execution.setVariable(Prefix+"resourceFinish", true)
\r
749 sortCreateResource(execution)
\r
751 }catch(Exception e){
\r
752 utils.log("ERROR", "Exception Occured Processing getServiceResources. Exception is:\n" + e, isDebugEnabled)
\r
753 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during getServiceResources Method:\n" + e.getMessage())
\r
755 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
759 * prepare Decompose next resource to create request
\r
761 public void preProcessDecomposeNextResource(Execution execution){
\r
762 def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
\r
763 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
764 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
765 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessDecomposeNextResource Process ======== ", isDebugEnabled)
\r
767 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
768 List<String> resourceList = execution.getVariable(Prefix+"resourceList")
\r
769 utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
\r
771 String resource = resourceList[resourceNum]
\r
772 execution.setVariable(Prefix+"resource", resource)
\r
773 utils.log("INFO", "Current Resource : " + resource, isDebugEnabled)
\r
775 String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
\r
776 execution.setVariable(Prefix+"resourceName", resourceName)
\r
777 utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
\r
779 String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
\r
780 execution.setVariable("resourceUUID", resourceUUID)
\r
781 utils.log("INFO", "resource UUID : " + resourceUUID, isDebugEnabled)
\r
783 String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
\r
784 execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
\r
787 String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
\r
788 execution.setVariable("resourceParameters", resourceParameters)
\r
789 utils.log("INFO", "resource Parameters : " + resourceParameters, isDebugEnabled)
\r
791 execution.setVariable(Prefix+"nextResource", resourceNum + 1)
\r
792 utils.log("INFO", "next Resource num : " + execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
794 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
795 if (resourceCount >0 ){
\r
796 int progress = (resourceNum*100) / resourceCount
\r
797 execution.setVariable("progress", progress.toString() )
\r
800 execution.setVariable("operationStatus", resourceName )
\r
802 }catch(Exception e){
\r
803 utils.log("ERROR", "Exception Occured Processing preProcessDecomposeNextResource. Exception is:\n" + e, isDebugEnabled)
\r
804 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during preProcessDecomposeNextResource Method:\n" + e.getMessage())
\r
806 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
809 * post Decompose next resource to create request
\r
811 public void postProcessDecomposeNextResource(Execution execution){
\r
812 def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
\r
813 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
814 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
815 utils.log("INFO", " ======== STARTED DoCreateE2EServiceInstanceV2 postProcessDecomposeNextResource Process ======== ", isDebugEnabled)
\r
817 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
819 int resourceNum = execution.getVariable(Prefix+"nextResource")
\r
820 utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
\r
822 int resourceCount = execution.getVariable(Prefix+"resourceCount")
\r
823 utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
\r
825 if (resourceNum < resourceCount) {
\r
826 execution.setVariable(Prefix+"resourceFinish", false)
\r
829 execution.setVariable(Prefix+"resourceFinish", true)
\r
832 utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)
\r
834 if (resourceCount >0 ){
\r
835 int progress = (resourceNum*100) / resourceCount
\r
836 execution.setVariable("progress", progress.toString() )
\r
837 utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)
\r
839 execution.setVariable("operationStatus", resourceName )
\r
841 }catch(Exception e){
\r
842 // try error in method block
\r
843 String exceptionMessage = "Bpmn error encountered in "+method + "- " + e.getMessage()
\r
844 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
845 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
847 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
850 * prepare check Resource Type
\r
852 public void checkResourceType(Execution execution){
\r
853 def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')'
\r
854 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
855 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
856 String resourceControllerTypeDef = """[
\r
858 "resourceType":"vEPC",
\r
859 "controllerType":"VFC"
\r
862 "resourceType":"vIMS",
\r
863 "controllerType":"VFC"
\r
866 "resourceType":"vCPE",
\r
867 "controllerType":"VFC"
\r
870 "resourceType":"vFW",
\r
871 "controllerType":"VFC"
\r
874 "resourceType":"Underlay",
\r
875 "controllerType":"SDNC"
\r
878 "resourceType":"Overlay",
\r
879 "controllerType":"SDNC"
\r
882 "resourceType":"VPN_SAR",
\r
883 "controllerType":"SDNC"
\r
886 "resourceType":"GRE_AAR",
\r
887 "controllerType":"APPC"
\r
890 "resourceType":"GRE_SAR",
\r
891 "controllerType":"SDNC"
\r
894 "resourceType":"APN_AAR",
\r
895 "controllerType":"APPC"
\r
902 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
903 utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
\r
904 execution.setVariable("resourceName", resourceName)
\r
906 String[] split = resourceName.split("_")
\r
908 utils.log("INFO", "split : " + split, isDebugEnabled)
\r
909 int strLen = split.size()
\r
910 String allottedResourceType = ""
\r
913 allottedResourceType = split[0]
\r
916 allottedResourceType = split[0] + "_" + split[1]
\r
919 loadResourcesProperties(execution)
\r
920 String resourceControllerType= execution.getVariable("resourceControllerType")
\r
921 if (isBlank(resourceControllerType)) {
\r
922 resourceControllerType = resourceControllerTypeDef;
\r
924 utils.log("INFO", "resourceControllerType: " + resourceControllerType, isDebugEnabled)
\r
926 List<String> ResourceTypeList = jsonUtil.StringArrayToList(execution, resourceControllerType)
\r
927 utils.log("INFO", "ResourceTypeList : " + ResourceTypeList, isDebugEnabled)
\r
928 execution.setVariable("controllerType", "Other")
\r
929 execution.setVariable(Prefix+"resourceType", "")
\r
930 for (String resourceMap : ResourceTypeList) {
\r
931 String resourceType = jsonUtil.getJsonValue(resourceMap, "resourceType")
\r
932 String controllerType = jsonUtil.getJsonValue(resourceMap, "controllerType")
\r
933 //utils.log("INFO", "resourceMap.resourceType : " + resourceType, isDebugEnabled)
\r
934 //utils.log("INFO", "resourceMap.controllerType : " + controllerType, isDebugEnabled)
\r
935 //utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
\r
936 //utils.log("INFO", "allottedResourceType : " + allottedResourceType, isDebugEnabled )
\r
938 if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
\r
939 execution.setVariable("controllerType", controllerType)
\r
940 execution.setVariable(Prefix+"resourceType", resourceType)
\r
941 utils.log("INFO", "found controller type : " + controllerType, isDebugEnabled)
\r
945 utils.log("INFO", "controller Type : " + execution.getVariable("controllerType"), isDebugEnabled)
\r
946 utils.log("INFO", "resource Type : " + execution.getVariable(Prefix+"resourceType"), isDebugEnabled)
\r
948 if (execution.getVariable("controllerType") == "") {
\r
949 String exceptionMessage = "Resource name can not find controller type,please check the resource Name: "+ resourceName
\r
950 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
951 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
953 if (execution.getVariable(Prefix+"resourceType") == "vCPE") {
\r
954 execution.setVariable("skipVFC", "false")
\r
955 utils.log("INFO", "vCPE will deploy ", isDebugEnabled)
\r
958 }catch(Exception e){
\r
959 // try error in method block
\r
960 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
961 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
962 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
964 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
967 * prepare post Unkown Resource Type
\r
969 public void postOtherControllerType(Execution execution){
\r
970 def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
\r
971 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
972 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
974 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postOtherControllerType Process ======== ", isDebugEnabled)
\r
977 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
978 String resourceType = execution.getVariable(Prefix+"resourceType")
\r
979 String controllerType = execution.getVariable("controllerType")
\r
981 String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
\r
982 utils.log("DEBUG", msg, isDebugEnabled)
\r
984 }catch(Exception e){
\r
985 // try error in method block
\r
986 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
987 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
\r
988 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
\r
990 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
994 * prepare Controller resource create request
\r
996 public void preProcessResourceRequestForController(execution){
\r
997 def method = getClass().getSimpleName() + '.preProcessResourceRequestForController(' +'execution=' + execution.getId() +')'
\r
998 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
999 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
1000 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessResourceRequestForController Process ======== ", isDebugEnabled)
\r
1002 String resourceName = execution.getVariable(Prefix+"resourceName")
\r
1003 String resourceType = execution.getVariable(Prefix+"resourceType")
\r
1004 String serviceInstanceName =execution.getVariable("serviceInstanceName")
\r
1005 String nsServiceName = resourceType + "_" + serviceInstanceName
\r
1006 execution.setVariable("nsServiceName", nsServiceName)
\r
1007 utils.log("INFO", "Prepare Controller Request nsServiceName:" + nsServiceName, isDebugEnabled)
\r
1009 String serviceId = execution.getVariable("serviceInstanceId")
\r
1010 execution.setVariable("serviceId", serviceId)
\r
1011 utils.log("INFO", "Prepare Controller Request serviceId:" + serviceId, isDebugEnabled)
\r
1013 String globalSubscriberId = execution.getVariable("globalSubscriberId")
\r
1014 utils.log("INFO", "Prepare Controller Request globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
\r
1016 String incomingRequest = execution.getVariable("uuiRequest")
\r
1017 String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
\r
1018 execution.setVariable("nsServiceDescription", nsServiceDescription)
\r
1019 utils.log("INFO", "Prepare Controller Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
\r
1021 String resourceUUID = execution.getVariable("resourceUUID")
\r
1023 utils.log("INFO", "Prepare Controller Request resourceUUID:" + resourceUUID, isDebugEnabled)
\r
1025 String resourceInvariantUUID = execution.getVariable("resourceInvariantUUID")
\r
1026 utils.log("INFO", "Prepare Controller Request resourceInvariantUUID:" + resourceInvariantUUID, isDebugEnabled)
\r
1028 String resourceParameters = execution.getVariable("resourceParameters")
\r
1029 execution.setVariable("resourceParameters", resourceParameters)
\r
1030 utils.log("INFO", "Prepare Controller Request resourceParameters:" + resourceParameters, isDebugEnabled)
\r
1034 }catch(Exception e){
\r
1035 String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
\r
1036 utils.log("ERROR", exceptionMessage, isDebugEnabled)
\r
1037 execution.setVariable(Prefix+"ErrorResponse", exceptionMessage)
\r
1039 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
1042 * post process VFC resource create request
\r
1044 public void postProcessResourceRequestForVFC(execution){
\r
1045 def method = getClass().getSimpleName() + '.postProcessResourceRequestForVFC(' +'execution=' + execution.getId() +')'
\r
1046 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
1047 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
1048 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForVFC Process ======== ", isDebugEnabled)
\r
1052 }catch(Exception e){
\r
1053 utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForVFC. Exception is:\n" + e, isDebugEnabled)
\r
1054 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForVFC Method:\n" + e.getMessage())
\r
1056 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r
1061 * post process SDNC resource create request
\r
1063 public void postProcessResourceRequestForSDNC(execution){
\r
1064 def method = getClass().getSimpleName() + '.postProcessResourceRequestForSDNC(' +'execution=' + execution.getId() +')'
\r
1065 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
1066 utils.log("INFO","Entered " + method, isDebugEnabled)
\r
1067 utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForSDNC Process ======== ", isDebugEnabled)
\r
1070 execution.setVariable("serviceSDNCCreate", "true")
\r
1072 }catch(Exception e){
\r
1073 utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForSDNC. Exception is:\n" + e, isDebugEnabled)
\r
1074 execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForSDNC Method:\n" + e.getMessage())
\r
1076 utils.log("INFO", "Exited " + method, isDebugEnabled)
\r