f2af481f669e22f1a5d41c197c1245d63c59f5fd
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoDeleteE2EServiceInstance.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22 package org.onap.so.bpmn.infrastructure.scripts
23
24 import groovy.json.JsonOutput
25 import groovy.json.JsonSlurper
26 import org.apache.commons.lang3.StringUtils
27 import org.camunda.bpm.engine.delegate.BpmnError
28 import org.camunda.bpm.engine.delegate.DelegateExecution
29 import org.json.JSONArray
30 import org.json.JSONObject
31 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
32 import org.onap.so.bpmn.common.scripts.ExceptionUtil
33 import org.onap.so.bpmn.common.scripts.MsoUtils
34 import org.onap.so.bpmn.core.UrnPropertiesReader
35 import org.onap.so.bpmn.core.WorkflowException
36 import org.onap.so.bpmn.core.domain.Resource
37 import org.onap.so.bpmn.core.domain.ServiceDecomposition
38 import org.onap.so.bpmn.core.json.JsonUtils
39 import org.onap.so.client.HttpClient
40 import org.onap.so.client.HttpClientFactory
41 import org.slf4j.Logger
42 import org.slf4j.LoggerFactory
43 import org.onap.so.utils.TargetEntity
44 import org.springframework.web.util.UriUtils
45 import org.w3c.dom.Document
46 import org.w3c.dom.Node
47 import org.xml.sax.InputSource
48
49 import javax.ws.rs.core.Response
50 import javax.xml.parsers.DocumentBuilder
51 import javax.xml.parsers.DocumentBuilderFactory
52
53 import static org.apache.commons.lang3.StringUtils.isBlank
54
55 /**
56  * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
57  *
58  * Inputs:
59  * @param - msoRequestId
60  * @param - globalSubscriberId - O
61  * @param - subscriptionServiceType - O
62  * @param - serviceInstanceId
63  * @param - serviceInstanceName - O
64  * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
65  * @param - sdncVersion
66  * @param - failNotFound - TODO
67  * @param - serviceInputParams - TODO
68  *
69  * @param - delResourceList
70  * @param - serviceRelationShip
71  *
72  * Outputs:
73  * @param - WorkflowException
74  *
75  * Rollback - Deferred
76  */
77 public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
78
79         String Prefix="DDEESI_"
80     ExceptionUtil exceptionUtil = new ExceptionUtil()
81     JsonUtils jsonUtil = new JsonUtils()
82     private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class);
83
84
85     public void preProcessRequest (DelegateExecution execution) {
86         logger.debug(" ***** preProcessRequest *****")
87         String msg = ""
88
89         try {
90             String requestId = execution.getVariable("msoRequestId")
91             execution.setVariable("prefix",Prefix)
92
93             //Inputs
94             //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
95             String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
96             if (globalSubscriberId == null)
97             {
98                 execution.setVariable("globalSubscriberId", "")
99             }
100
101             //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
102             String serviceType = execution.getVariable("serviceType")
103             if (serviceType == null)
104             {
105                 execution.setVariable("serviceType", "")
106             }
107
108             //Generated in parent for AAI PUT
109             String serviceInstanceId = execution.getVariable("serviceInstanceId")
110             if (isBlank(serviceInstanceId)){
111                 msg = "Input serviceInstanceId is null"
112                 logger.info(msg)
113                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
114             }
115
116             String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution)
117             if (isBlank(sdncCallbackUrl)) {
118                 msg = "URN_mso_workflow_sdncadapter_callback is null"
119                 logger.info(msg)
120                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
121             }
122             execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
123             logger.info("SDNC Callback URL: " + sdncCallbackUrl)
124
125             StringBuilder sbParams = new StringBuilder()
126             Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
127
128             if (paramsMap != null) {
129                 sbParams.append("<service-input-parameters>")
130                 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
131                     String paramsXml
132                     String paramName = entry.getKey()
133                     String paramValue = entry.getValue()
134                     paramsXml =
135                             """ <param>
136                                                         <name>${MsoUtils.xmlEscape(paramName)}</name>
137                                                         <value>${MsoUtils.xmlEscape(paramValue)}</value>
138                                                         </param>
139                                                         """
140                     sbParams.append(paramsXml)
141                 }
142                 sbParams.append("</service-input-parameters>")
143             }
144             String siParamsXml = sbParams.toString()
145             if (siParamsXml == null)
146                 siParamsXml = ""
147             execution.setVariable("siParamsXml", siParamsXml)
148
149         } catch (BpmnError e) {
150             throw e;
151         } catch (Exception ex){
152             msg = "Exception in preProcessRequest " + ex.getMessage()
153             logger.error(msg)
154             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
155         }
156         logger.debug("***** Exit preProcessRequest *****")
157     }
158
159     public void postProcessAAIGET(DelegateExecution execution) {
160         logger.debug(" ***** postProcessAAIGET ***** ")
161         String msg = ""
162
163         try {
164             String serviceInstanceId = execution.getVariable("serviceInstanceId")
165             boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
166             String serviceType = ""
167
168             if(foundInAAI){
169                 logger.debug("Found Service-instance in AAI")
170
171                 String siData = execution.getVariable("GENGS_service")
172                 logger.debug("SI Data")
173                 if (isBlank(siData))
174                 {
175                     msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
176                     logger.error(msg)
177                     exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
178                 }
179                 else
180                 {
181                     InputSource source = new InputSource(new StringReader(siData));
182                     DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
183                     DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
184                     Document serviceXml = docBuilder.parse(source)
185                     serviceXml.getDocumentElement().normalize()
186                     // get model invariant id
187                     // Get Template uuid and version
188                     if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
189                         logger.debug("SI Data model-invariant-id and model-version-id exist")
190                         def modelInvariantId  = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
191                         def modelVersionId  = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
192
193                         // Set Original Template info
194                         execution.setVariable("model-invariant-id-original", modelInvariantId)
195                         execution.setVariable("model-version-id-original", modelVersionId)
196                     }
197
198                     logger.debug("SI Data" + siData)
199                     //Confirm there are no related service instances (vnf/network or volume)
200                     if (utils.nodeExists(siData, "relationship-list")) {
201                         logger.debug("SI Data relationship-list exists")
202                         JSONArray jArray = new JSONArray()
203
204                         XmlParser xmlParser = new XmlParser()
205                         Node root = xmlParser.parseText(siData)
206                         def relation_list = utils.getChildNode(root, 'relationship-list')
207                         def relationships = utils.getIdenticalChildren(relation_list, 'relationship')
208
209                         for (def relation: relationships) {
210                                 def jObj = getRelationShipData(relation, isDebugEnabled)
211                                 jArray.put(jObj)
212                         }
213
214                         execution.setVariable("serviceRelationShip", jArray.toString())
215                         execution.setVariable("serviceRelationShip", jArray.toString())
216                     }
217                 }
218             }else{
219                 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
220                 if(!succInAAI){
221                     logger.debug("Error getting Service-instance from AAI :" + serviceInstanceId)
222                     WorkflowException workflowException = execution.getVariable("WorkflowException")
223                     if(workflowException != null){
224                         logger.error("workflowException: " + workflowException)
225                         exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
226                     }
227                     else {
228                         msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
229                         logger.error(msg)
230                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
231                     }
232                 }
233
234                 logger.debug("Service-instance NOT found in AAI. Silent Success")
235             }
236         }catch (BpmnError e) {
237             throw e
238         } catch (Exception ex) {
239             msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
240             logger.debug(msg)
241             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
242         }
243         logger.debug(" *** Exit postProcessAAIGET *** ")
244     }
245
246         private JSONObject getRelationShipData(node, isDebugEnabled){
247                 JSONObject jObj = new JSONObject()
248
249                 def relation  = utils.nodeToString(node)
250                 def rt  = utils.getNodeText(relation, "related-to")
251
252                 def rl  = utils.getNodeText(relation, "related-link")
253                 logger.debug("ServiceInstance Related NS/Configuration :" + rl)
254
255                 def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
256                 for(def rl_data : rl_datas) {
257                         def eKey =  utils.getChildNodeText(rl_data, "relationship-key")
258                         def eValue = utils.getChildNodeText(rl_data, "relationship-value")
259
260                         if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id"))
261                         //for overlay/underlay
262                         || (rt == "configuration" && eKey.equals("configuration.configuration-id")
263                         )){
264                                 jObj.put("resourceInstanceId", eValue)
265                         }
266                         // for sp-partner and others
267                         else if(eKey.endsWith("-id")){
268                                 jObj.put("resourceInstanceId", eValue)
269                                 String resourceName = rt + eValue;
270                                 jObj.put("resourceType", resourceName)
271                         }
272
273                         jObj.put("resourceLinkUrl", rl)
274                 }
275
276                 def rl_props = utils.getIdenticalChildren(node, "related-to-property")
277                 for(def rl_prop : rl_props) {
278                         def eKey =  utils.getChildNodeText(rl_prop, "property-key")
279                         def eValue = utils.getChildNodeText(rl_prop, "property-value")
280                         if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name"))
281                         //for overlay/underlay
282                         || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){
283                                 jObj.put("resourceType", eValue)
284                         }
285                 }
286
287                 logger.debug("Relationship related to Resource:" + jObj.toString())
288                 return jObj
289         }
290
291    public void getCurrentNS(DelegateExecution execution){
292        logger.info( "======== Start getCurrentNS Process ======== ")
293
294        def currentIndex = execution.getVariable("currentNSIndex")
295        List<String> nsSequence = execution.getVariable("nsSequence")
296        String nsResourceType =  nsSequence.get(currentIndex)
297
298        // GET AAI by Name, not ID, for process convenient
299        execution.setVariable("GENGS_type", "service-instance")
300        execution.setVariable("GENGS_serviceInstanceId", "")
301        execution.setVariable("GENGS_serviceInstanceName", nsResourceType)
302
303        logger.debug("======== COMPLETED getCurrentNS Process ======== ")
304    }
305
306     public void prepareDecomposeService(DelegateExecution execution) {
307         try {
308             logger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ")
309             String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
310             String modelVersionId = execution.getVariable("model-version-id-original")
311
312             String serviceModelInfo = """{
313             "modelInvariantUuid":"${modelInvariantUuid}",
314             "modelUuid":"${modelVersionId}",
315             "modelVersion":""
316              }"""
317             execution.setVariable("serviceModelInfo", serviceModelInfo)
318
319             logger.debug(" ***** Completed prepareDecomposeService of  create generic e2e service ***** ")
320         } catch (Exception ex) {
321             // try error in method block
322             String exceptionMessage = "Bpmn error encountered in  create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
323             logger.error(exceptionMessage)
324             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
325         }
326     }
327
328         private void generateRelatedResourceInfo(String response, JSONObject jObj){
329
330                 def xml = new XmlSlurper().parseText(response)
331                 def rtn = xml.childNodes()
332                 while (rtn.hasNext()) {
333                         groovy.util.slurpersupport.Node node = rtn.next()
334                         def key = node.name()
335                         def value = node.text()
336                         jObj.put(key, value)
337                 }
338         }
339
340         private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj)
341         {
342                 logger.debug(" ***** Started getRelatedResourceInAAI *****")
343
344         String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
345                 String urlLink = jObj.get("resourceLinkUrl")
346                 String serviceAaiPath = "${aai_endpoint}${urlLink}"
347
348                 URL url = new URL(serviceAaiPath)
349                 HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
350
351
352                 Response response = client.get()
353                 int responseCode = response.getStatus()
354                 execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode)
355                 logger.debug("  Get RelatedResource code is: " + responseCode)
356
357                 String aaiResponse = response.readEntity(String.class)
358                 execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse)
359
360                 //Process Response
361                 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
362                         //200 OK 201 CREATED 202 ACCEPTED
363                 {
364                         logger.debug("GET RelatedResource Received a Good Response")
365                         execution.setVariable(Prefix + "SuccessIndicator", true)
366                         execution.setVariable(Prefix + "FoundIndicator", true)
367
368                         generateRelatedResourceInfo(aaiResponse, jObj)
369
370                         //get model-invariant-uuid and model-uuid
371                         String modelInvariantId = ""
372                         String modelUuid = ""
373                         String modelCustomizationId = ""
374                         if(jObj.has("model-invariant-id")) {
375                                 modelInvariantId = jObj.get("model-invariant-id")
376                                 modelUuid = jObj.get("model-version-id")
377                                 modelCustomizationId = jObj.get("model-customization-id")
378                         }
379
380                         jObj.put("modelInvariantId", modelInvariantId)
381                         jObj.put("modelVersionId", modelUuid)
382                         jObj.put("modelCustomizationId", modelCustomizationId)
383                 }
384                 else {
385             String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode
386                         logger.error(exceptionMessage)
387             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
388         }
389
390                 logger.debug(" ***** Exit getRelatedResourceInAAI *****")
391                 return jObj
392         }
393
394     public void postDecomposeService(DelegateExecution execution) {
395         logger.debug(" ***** Inside processDecomposition() of  delete generic e2e service flow ***** ")
396         try {
397             ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
398
399             // service model info
400             execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
401
402             List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
403             String serviceRelationShip = execution.getVariable("serviceRelationShip")
404             def jsonSlurper = new JsonSlurper()
405             def jsonOutput = new JsonOutput()
406
407             List relationShipList = null
408             if (serviceRelationShip != null) {
409                 relationShipList = jsonSlurper.parseText(serviceRelationShip)
410             }
411
412             List<Resource> deleteRealResourceList = new ArrayList<Resource>()
413
414             //Set the real resource instance id to the decomosed resource list
415             //reset the resource instance id , because in the decompose flow ,its a random one.
416             //match the resource-instance-name and the model name
417             if (relationShipList != null) {
418                 relationShipList.each {
419
420                     JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it)
421
422                     for (Resource resource : deleteResourceList) {
423
424                         String modelName = resource.getModelInfo().getModelName()
425
426                         String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid()
427                         if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
428                             resource.setResourceId(obj.get("resourceInstanceId"))
429                             deleteRealResourceList.add(resource)
430                         }
431                         else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) {
432                             resource.setResourceId(obj.get("resourceInstanceId"))
433                             resource.setResourceInstanceName(obj.get("resourceType"))
434                             deleteRealResourceList.add(resource)
435                         }
436                     }
437                 }
438             }
439
440             // only delete real existing resources
441             execution.setVariable("deleteResourceList", deleteRealResourceList)
442             
443             boolean isDeleteResourceListValid = false
444             if(deleteRealResourceList.size() > 0) {
445                 isDeleteResourceListValid = true
446             }
447             execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid)
448
449             logger.debug("delete resource list : " + deleteRealResourceList)
450         } catch (Exception ex) {
451             String exceptionMessage = "Bpmn error encountered in  create generic e2e service flow. processDecomposition() - " + ex.getMessage()
452             logger.error(exceptionMessage)
453             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
454         }
455         logger.debug( " ***** exit processDecomposition() of  delete generic e2e service flow ***** ")
456     }
457
458     public void preInitResourcesOperStatus(DelegateExecution execution){
459         logger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ")
460         try{
461             String serviceId = execution.getVariable("serviceInstanceId")
462             String operationId = execution.getVariable("operationId")
463             String operationType = execution.getVariable("operationType")
464             String resourceTemplateUUIDs = ""
465             String result = "processing"
466             String progress = "0"
467             String reason = ""
468             String operationContent = "Prepare service creation"
469             logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
470             serviceId = UriUtils.encode(serviceId,"UTF-8")
471             execution.setVariable("serviceInstanceId", serviceId)
472             execution.setVariable("operationId", operationId)
473             execution.setVariable("operationType", operationType)
474             List<Resource> deleteResourceList = execution.getVariable("deleteResourceList")
475
476             String serviceRelationShip = execution.getVariable("serviceRelationShip")
477             for(Resource resource : deleteResourceList){
478                     resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
479             }
480
481             def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
482             execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
483
484             String payload =
485                     """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
486                         xmlns:ns="http://org.onap.so/requestsdb">
487                         <soapenv:Header/>
488                         <soapenv:Body>
489                             <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
490                             <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
491                             <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
492                             <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
493                             <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
494                         </ns:initResourceOperationStatus>
495                     </soapenv:Body>
496                 </soapenv:Envelope>"""
497
498             payload = utils.formatXml(payload)
499             execution.setVariable("CVFMI_initResOperStatusRequest", payload)
500             logger.debug("Outgoing initResourceOperationStatus: \n" + payload)
501             logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
502
503         }catch(Exception e){
504             logger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
505             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
506         }
507         logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ")
508     }
509     
510     public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
511         logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ")
512         try{
513             String serviceId = execution.getVariable("serviceInstanceId")
514             String operationId = execution.getVariable("operationId")
515             String userId = ""
516             String result = execution.getVariable("result")
517             String progress = execution.getVariable("progress")
518             String reason = ""
519             String operationContent = execution.getVariable("operationContent")
520             
521             serviceId = UriUtils.encode(serviceId,"UTF-8")
522
523             def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
524             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
525             logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
526
527             String payload =
528                     """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
529                         xmlns:ns="http://org.onap.so/requestsdb">
530                         <soapenv:Header/>
531                         <soapenv:Body>
532                             <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
533                             <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
534                             <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
535                             <operationType>DELETE</operationType>
536                             <userId>${MsoUtils.xmlEscape(userId)}</userId>
537                             <result>${MsoUtils.xmlEscape(result)}</result>
538                             <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
539                             <progress>${MsoUtils.xmlEscape(progress)}</progress>
540                             <reason>${MsoUtils.xmlEscape(reason)}</reason>
541                         </ns:updateServiceOperationStatus>
542                     </soapenv:Body>
543                 </soapenv:Envelope>"""
544
545             payload = utils.formatXml(payload)
546             execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
547             logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
548
549         }catch(Exception e){
550             logger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e)
551             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage())
552         }
553         logger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ")
554     }
555
556      /**
557       * post config request.
558       */
559      public void postConfigRequest(execution){
560          //to do
561      }
562
563 }