2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.so.bpmn.infrastructure.scripts
22 import static org.apache.commons.lang3.StringUtils.*;
24 import javax.ws.rs.core.Response
25 import javax.xml.parsers.DocumentBuilder
26 import javax.xml.parsers.DocumentBuilderFactory
28 import org.apache.commons.lang3.*
29 import org.camunda.bpm.engine.delegate.BpmnError
30 import org.camunda.bpm.engine.delegate.DelegateExecution
31 import org.json.JSONArray
32 import org.json.JSONObject
34 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
35 import org.onap.so.bpmn.common.scripts.ExceptionUtil
36 import org.onap.so.bpmn.common.scripts.MsoUtils
37 import org.onap.so.bpmn.core.WorkflowException
38 import org.onap.so.bpmn.core.domain.Resource
39 import org.onap.so.bpmn.core.domain.ServiceDecomposition
40 import org.onap.so.bpmn.core.UrnPropertiesReader
42 import org.onap.so.utils.TargetEntity
43 import org.onap.so.bpmn.core.json.JsonUtils
44 import org.onap.so.client.HttpClient
45 import org.springframework.web.util.UriUtils
46 import org.w3c.dom.Document
47 import org.w3c.dom.Element
48 import org.w3c.dom.Node
49 import org.w3c.dom.NodeList
50 import org.xml.sax.InputSource
55 * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
58 * @param - msoRequestId
59 * @param - globalSubscriberId - O
60 * @param - subscriptionServiceType - O
61 * @param - serviceInstanceId
62 * @param - serviceInstanceName - O
63 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
64 * @param - sdncVersion
65 * @param - failNotFound - TODO
66 * @param - serviceInputParams - TODO
68 * @param - delResourceList
69 * @param - serviceRelationShip
72 * @param - WorkflowException
76 public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
78 String Prefix="DDEESI_"
79 ExceptionUtil exceptionUtil = new ExceptionUtil()
80 JsonUtils jsonUtil = new JsonUtils()
82 public void preProcessRequest (DelegateExecution execution) {
83 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
84 utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
88 String requestId = execution.getVariable("msoRequestId")
89 execution.setVariable("prefix",Prefix)
92 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
93 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
94 if (globalSubscriberId == null)
96 execution.setVariable("globalSubscriberId", "")
99 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
100 String serviceType = execution.getVariable("serviceType")
101 if (serviceType == null)
103 execution.setVariable("serviceType", "")
106 //Generated in parent for AAI PUT
107 String serviceInstanceId = execution.getVariable("serviceInstanceId")
108 if (isBlank(serviceInstanceId)){
109 msg = "Input serviceInstanceId is null"
110 utils.log("INFO", msg, isDebugEnabled)
111 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
114 String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
115 if (isBlank(sdncCallbackUrl)) {
116 msg = "URN_mso_workflow_sdncadapter_callback is null"
117 utils.log("INFO", msg, isDebugEnabled)
118 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
120 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
121 utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
123 StringBuilder sbParams = new StringBuilder()
124 Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
125 if (paramsMap != null)
127 sbParams.append("<service-input-parameters>")
128 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
130 String paramName = entry.getKey()
131 String paramValue = entry.getValue()
134 <name>${MsoUtils.xmlEscape(paramName)}</name>
135 <value>${MsoUtils.xmlEscape(paramValue)}</value>
138 sbParams.append(paramsXml)
140 sbParams.append("</service-input-parameters>")
142 String siParamsXml = sbParams.toString()
143 if (siParamsXml == null)
145 execution.setVariable("siParamsXml", siParamsXml)
147 } catch (BpmnError e) {
149 } catch (Exception ex){
150 msg = "Exception in preProcessRequest " + ex.getMessage()
151 utils.log("INFO", msg, isDebugEnabled)
152 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
154 utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
157 public void postProcessAAIGET(DelegateExecution execution) {
158 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
159 utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
163 String serviceInstanceId = execution.getVariable("serviceInstanceId")
164 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
165 String serviceType = ""
168 utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
170 String siData = execution.getVariable("GENGS_service")
171 utils.log("INFO", "SI Data", isDebugEnabled)
174 msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
175 utils.log("INFO", msg, isDebugEnabled)
176 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
180 InputSource source = new InputSource(new StringReader(siData));
181 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
182 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
183 Document serviceXml = docBuilder.parse(source)
184 serviceXml.getDocumentElement().normalize()
185 // get model invariant id
186 // Get Template uuid and version
187 if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
188 utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
189 def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
190 def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
192 // Set Original Template info
193 execution.setVariable("model-invariant-id-original", modelInvariantId)
194 execution.setVariable("model-version-id-original", modelVersionId)
197 utils.log("INFO", "SI Data" + siData, isDebugEnabled)
198 //Confirm there are no related service instances (vnf/network or volume)
199 if (utils.nodeExists(siData, "relationship-list")) {
200 utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
201 JSONArray jArray = new JSONArray()
203 XmlParser xmlParser = new XmlParser()
204 Node root = xmlParser.parseText(siData)
205 def relation_list = utils.getChildNode(root, 'relationship-list')
206 def relationships = utils.getIdenticalChildren(relation_list, 'relationship')
208 for (def relation: relationships) {
209 def jObj = getRelationShipData(relation, isDebugEnabled)
213 execution.setVariable("serviceRelationShip", jArray.toString())
216 // NodeList nodeList = serviceXml.getElementsByTagName("relationship")
217 // JSONArray jArray = new JSONArray()
218 // for (int x = 0; x < nodeList.getLength(); x++) {
219 // Node node = nodeList.item(x)
220 // if (node.getNodeType() == Node.ELEMENT_NODE) {
221 // Element eElement = (Element) node
222 // def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
223 // if(e.equals("service-instance")){
224 // def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
225 // utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)
226 // NodeList dataList = node.getChildNodes()
227 // if(null != dataList) {
228 // JSONObject jObj = new JSONObject()
229 // for (int i = 0; i < dataList.getLength(); i++) {
230 // Node dNode = dataList.item(i)
231 // if(dNode.getNodeName() == "relationship-data") {
232 // Element rDataEle = (Element)dNode
233 // def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
234 // def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
235 // if(eKey.equals("service-instance.service-instance-id")){
236 // jObj.put("resourceInstanceId", eValue)
240 // else if(dNode.getNodeName() == "related-to-property"){
241 // Element rDataEle = (Element)dNode
242 // def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
243 // def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
244 // if(eKey.equals("service-instance.service-instance-name")){
245 // jObj.put("resourceType", eValue)
249 // utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
252 // //for overlay/underlay
253 // }else if (e.equals("configuration")){
254 // def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
255 // utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)
256 // NodeList dataList = node.getChildNodes()
257 // if(null != dataList) {
258 // JSONObject jObj = new JSONObject()
259 // for (int i = 0; i < dataList.getLength(); i++) {
260 // Node dNode = dataList.item(i)
261 // if(dNode.getNodeName() == "relationship-data") {
262 // Element rDataEle = (Element)dNode
263 // def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
264 // def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
265 // if(eKey.equals("configuration.configuration-id")){
266 // jObj.put("resourceInstanceId", eValue)
269 // else if(dNode.getNodeName() == "related-to-property"){
270 // Element rDataEle = (Element)dNode
271 // def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
272 // def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
273 // if(eKey.equals("configuration.configuration-type")){
274 // jObj.put("resourceType", eValue)
278 // utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
282 // }else if (e.equals("sp-partner")){
287 // execution.setVariable("serviceRelationShip", jArray.toString())
291 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
293 utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
294 WorkflowException workflowException = execution.getVariable("WorkflowException")
295 utils.logAudit("workflowException: " + workflowException)
296 if(workflowException != null){
297 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
301 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
302 utils.log("INFO", msg, isDebugEnabled)
303 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
307 utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
309 }catch (BpmnError e) {
311 } catch (Exception ex) {
312 msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
313 utils.log("INFO", msg, isDebugEnabled)
314 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
316 utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
319 private JSONObject getRelationShipData(node, isDebugEnabled){
320 JSONObject jObj = new JSONObject()
322 def relation = utils.nodeToString(node)
323 def rt = utils.getNodeText(relation, "related-to")
325 def rl = utils.getNodeText(relation, "related-link")
326 utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled)
328 def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
329 for(def rl_data : rl_datas) {
330 def eKey = utils.getChildNodeText(rl_data, "relationship-key")
331 def eValue = utils.getChildNodeText(rl_data, "relationship-value")
333 if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id"))
334 //for overlay/underlay
335 || (rt == "configuration" && eKey.equals("configuration.configuration-id")
337 jObj.put("resourceInstanceId", eValue)
339 // for sp-partner and others
340 else if(eKey.endsWith("-id")){
341 jObj.put("resourceInstanceId", eValue)
342 String resourceName = rt + eValue;
343 jObj.put("resourceType", resourceName)
346 jObj.put("resourceLinkUrl", rl)
349 def rl_props = utils.getIdenticalChildren(node, "related-to-property")
350 for(def rl_prop : rl_props) {
351 def eKey = utils.getChildNodeText(rl_prop, "property-key")
352 def eValue = utils.getChildNodeText(rl_prop, "property-value")
353 if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name"))
354 //for overlay/underlay
355 || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){
356 jObj.put("resourceType", eValue)
360 utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
365 public void getCurrentNS(DelegateExecution execution){
366 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
367 utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled)
369 def currentIndex = execution.getVariable("currentNSIndex")
370 List<String> nsSequence = execution.getVariable("nsSequence")
371 String nsResourceType = nsSequence.get(currentIndex)
373 // GET AAI by Name, not ID, for process convenient
374 execution.setVariable("GENGS_type", "service-instance")
375 execution.setVariable("GENGS_serviceInstanceId", "")
376 execution.setVariable("GENGS_serviceInstanceName", nsResourceType)
378 utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled)
381 public void prepareDecomposeService(DelegateExecution execution) {
382 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
385 utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
386 String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
387 String modelVersionId = execution.getVariable("model-version-id-original")
389 String serviceModelInfo = """{
390 "modelInvariantUuid":"${modelInvariantUuid}",
391 "modelUuid":"${modelVersionId}",
394 execution.setVariable("serviceModelInfo", serviceModelInfo)
396 utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
397 } catch (Exception ex) {
398 // try error in method block
399 String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
400 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
404 private void generateRelatedResourceInfo(String response, JSONObject jObj){
406 def xml = new XmlSlurper().parseText(response)
407 def rtn = xml.childNodes()
408 while (rtn.hasNext()) {
409 groovy.util.slurpersupport.Node node = rtn.next()
410 def key = node.name()
411 def value = node.text()
416 private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj)
418 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
419 utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled)
421 // AaiUtil aaiUriUtil = new AaiUtil()
422 // String aai_endpoint = execution.getVariable("URN_aai_endpoint")
423 String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
424 String urlLink = jObj.get("resourceLinkUrl")
425 String serviceAaiPath = "${aai_endpoint}${urlLink}"
427 URL url = new URL(serviceAaiPath)
428 HttpClient client = new HttpClient(url, "application/xml", TargetEntity.AAI)
431 Response response = client.get()
432 int responseCode = response.getStatus()
433 execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode)
434 utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled)
436 String aaiResponse = response.readEntity(String.class)
437 execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse)
440 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
441 //200 OK 201 CREATED 202 ACCEPTED
443 utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled)
444 execution.setVariable(Prefix + "SuccessIndicator", true)
445 execution.setVariable(Prefix + "FoundIndicator", true)
447 generateRelatedResourceInfo(aaiResponse, jObj)
449 //get model-invariant-uuid and model-uuid
450 String modelInvariantId = ""
451 String modelUuid = ""
452 String modelCustomizationId = ""
453 if(jObj.has("model-invariant-id")) {
454 modelInvariantId = jObj.get("model-invariant-id")
455 modelUuid = jObj.get("model-version-id")
456 modelCustomizationId = jObj.get("model-customization-id")
459 jObj.put("modelInvariantId", modelInvariantId)
460 jObj.put("modelVersionId", modelUuid)
461 jObj.put("modelCustomizationId", modelCustomizationId)
465 utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
468 utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled)
473 public void postDecomposeService(DelegateExecution execution) {
474 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
476 utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
478 ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
480 // service model info
481 execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
483 List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
484 String serviceRelationShip = execution.getVariable("serviceRelationShip")
485 def jsonSlurper = new JsonSlurper()
486 def jsonOutput = new JsonOutput()
488 List relationShipList = null
489 if (serviceRelationShip != null) {
490 relationShipList = jsonSlurper.parseText(serviceRelationShip)
493 List<Resource> deleteRealResourceList = new ArrayList<Resource>()
495 //Set the real resource instance id to the decomosed resource list
496 //reset the resource instance id , because in the decompose flow ,its a random one.
497 //match the resource-instance-name and the model name
498 if (relationShipList != null) {
499 relationShipList.each {
501 JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it)
503 for (Resource resource : deleteResourceList) {
505 String modelName = resource.getModelInfo().getModelName()
507 String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid()
508 if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
509 resource.setResourceId(obj.get("resourceInstanceId"))
510 deleteRealResourceList.add(resource)
512 else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) {
513 resource.setResourceId(obj.get("resourceInstanceId"))
514 resource.setResourceInstanceName(obj.get("resourceType"))
515 deleteRealResourceList.add(resource)
521 // only delete real existing resources
522 execution.setVariable("deleteResourceList", deleteRealResourceList)
524 boolean isDeleteResourceListValid = false
525 if(deleteRealResourceList.size() > 0) {
526 isDeleteResourceListValid = true
528 execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid)
530 utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled)
531 } catch (Exception ex) {
532 String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage()
533 utils.log("DEBUG", exceptionMessage, isDebugEnabled)
534 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
536 utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
539 public void preInitResourcesOperStatus(DelegateExecution execution){
540 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
542 utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
544 String serviceId = execution.getVariable("serviceInstanceId")
545 String operationId = execution.getVariable("operationId")
546 String operationType = execution.getVariable("operationType")
547 String resourceTemplateUUIDs = ""
548 String result = "processing"
549 String progress = "0"
551 String operationContent = "Prepare service creation"
552 utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
553 serviceId = UriUtils.encode(serviceId,"UTF-8")
554 execution.setVariable("serviceInstanceId", serviceId)
555 execution.setVariable("operationId", operationId)
556 execution.setVariable("operationType", operationType)
557 List<Resource> deleteResourceList = execution.getVariable("deleteResourceList")
559 String serviceRelationShip = execution.getVariable("serviceRelationShip")
560 for(Resource resource : deleteResourceList){
561 resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
564 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
565 execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
568 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
569 xmlns:ns="http://org.onap.so/requestsdb">
572 <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
573 <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
574 <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
575 <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
576 <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
577 </ns:initResourceOperationStatus>
579 </soapenv:Envelope>"""
581 payload = utils.formatXml(payload)
582 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
583 utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
584 utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
587 utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
588 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
590 utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
593 public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
594 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
595 utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
597 String serviceId = execution.getVariable("serviceInstanceId")
598 String operationId = execution.getVariable("operationId")
600 String result = execution.getVariable("result")
601 String progress = execution.getVariable("progress")
603 String operationContent = execution.getVariable("operationContent")
605 serviceId = UriUtils.encode(serviceId,"UTF-8")
607 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
608 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
609 utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
612 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
613 xmlns:ns="http://org.onap.so/requestsdb">
616 <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
617 <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
618 <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
619 <operationType>DELETE</operationType>
620 <userId>${MsoUtils.xmlEscape(userId)}</userId>
621 <result>${MsoUtils.xmlEscape(result)}</result>
622 <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
623 <progress>${MsoUtils.xmlEscape(progress)}</progress>
624 <reason>${MsoUtils.xmlEscape(reason)}</reason>
625 </ns:updateServiceOperationStatus>
627 </soapenv:Envelope>"""
629 payload = utils.formatXml(payload)
630 execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
631 utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
634 utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
635 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage())
637 utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
641 * post config request.
643 public void postConfigRequest(execution){