--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. \r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+package org.openecomp.mso.bpmn.infrastructure.scripts;\r
+\r
+import static org.apache.commons.lang3.StringUtils.*;\r
+import groovy.xml.XmlUtil\r
+import groovy.json.*\r
+\r
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition\r
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance\r
+import org.openecomp.mso.bpmn.core.domain.ModelInfo\r
+import org.openecomp.mso.bpmn.core.json.JsonUtils\r
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil\r
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils\r
+import org.openecomp.mso.bpmn.core.RollbackData\r
+import org.openecomp.mso.bpmn.core.WorkflowException\r
+import org.openecomp.mso.rest.APIResponse;\r
+import org.openecomp.mso.rest.RESTClient\r
+import org.openecomp.mso.rest.RESTConfig\r
+\r
+import java.util.UUID;\r
+import javax.xml.parsers.DocumentBuilder\r
+import javax.xml.parsers.DocumentBuilderFactory\r
+\r
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.json.JSONObject;\r
+import org.json.JSONArray;\r
+import org.apache.commons.lang3.*\r
+import org.apache.commons.codec.binary.Base64;\r
+import org.springframework.web.util.UriUtils;\r
+\r
+import org.w3c.dom.Document\r
+import org.w3c.dom.Element\r
+import org.w3c.dom.Node\r
+import org.w3c.dom.NodeList\r
+import org.xml.sax.InputSource\r
+/**\r
+ * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.\r
+ *\r
+ * Inputs:\r
+ * @param - msoRequestId\r
+ * @param - globalSubscriberId\r
+ * @param - subscriptionServiceType\r
+ * @param - serviceInstanceId\r
+ * @param - serviceInstanceName - O\r
+ * @param - serviceModelInfo\r
+ * @param - productFamilyId\r
+ * @param - disableRollback\r
+ * @param - failExists - TODO\r
+ * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)\r
+ * @param - sdncVersion ("1610")\r
+ * @param - serviceDecomposition - Decomposition for R1710 \r
+ * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)\r
+ *\r
+ * Outputs:\r
+ * @param - rollbackData (localRB->null)\r
+ * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)\r
+ * @param - WorkflowException\r
+ * @param - serviceInstanceName - (GET from AAI if null in input)\r
+ *\r
+ */\r
+public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {\r
+\r
+ String Prefix="DUPDSI_"\r
+ private static final String DebugFlag = "isDebugEnabled"\r
+ \r
+ ExceptionUtil exceptionUtil = new ExceptionUtil()\r
+ JsonUtils jsonUtil = new JsonUtils()\r
+\r
+ public void preProcessRequest (Execution execution) {\r
+ //only for dug\r
+ execution.setVariable("isDebugLogEnabled","true")\r
+ execution.setVariable("unit_test", "true")\r
+ execution.setVariable("skipVFC", "true")\r
+ \r
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'\r
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+ utils.log("INFO","Entered " + method, isDebugEnabled)\r
+ String msg = ""\r
+ utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled)\r
+ \r
+ utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled) \r
+\r
+ try {\r
+ execution.setVariable("prefix", Prefix)\r
+ //Inputs\r
+ //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology\r
+ String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId\r
+ utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)\r
+ \r
+ //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology\r
+ String serviceType = execution.getVariable("serviceType")\r
+ utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)\r
+ \r
+ //requestDetails.requestParameters. for SDNC assignTopology\r
+ String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId\r
+\r
+ if (isBlank(globalSubscriberId)) {\r
+ msg = "Input globalSubscriberId is null"\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+ }\r
+ \r
+ if (isBlank(serviceType)) {\r
+ msg = "Input serviceType is null"\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+ }\r
+ \r
+ //Generated in parent for AAI \r
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
+ if (isBlank(serviceInstanceId)){\r
+ msg = "Input serviceInstanceId is null"\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+ }\r
+ \r
+ if (productFamilyId == null) {\r
+ execution.setVariable("productFamilyId", "")\r
+ }\r
+ \r
+ String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')\r
+ if (isBlank(sdncCallbackUrl)) {\r
+ msg = "URN_mso_workflow_sdncadapter_callback is null"\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+ }\r
+ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)\r
+ utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)\r
+\r
+ //requestDetails.modelInfo.for AAI PUT servieInstanceData \r
+ //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData \r
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
+ //String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
+ String uuiRequest = execution.getVariable("uuiRequest")\r
+ utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)\r
+ \r
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")\r
+ utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)\r
+ \r
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")\r
+ utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)\r
+ \r
+ String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")\r
+ utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)\r
+ execution.setVariable("serviceModelName", serviceModelName)\r
+ \r
+ //aai serviceType and Role can be setted as fixed value now.\r
+ String aaiServiceType = serviceType\r
+ String aaiServiceRole = serviceType+"Role"\r
+ \r
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)\r
+ execution.setVariable("model-invariant-id-target", modelInvariantUuid)\r
+ execution.setVariable("modelUuid", modelUuid)\r
+ execution.setVariable("model-version-id-target", modelUuid_target)\r
+\r
+ //AAI PUT\r
+ String oStatus = execution.getVariable("initialStatus") ?: ""\r
+ utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)\r
+ if ("TRANSPORT".equalsIgnoreCase(serviceType))\r
+ {\r
+ oStatus = "Update"\r
+ }\r
+\r
+ String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"\r
+ utils.log("INFO","statusLine: " + statusLine, isDebugEnabled) \r
+ AaiUtil aaiUriUtil = new AaiUtil(this)\r
+ utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) \r
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)\r
+ utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)\r
+ String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)\r
+ utils.log("INFO","namespace: " + namespace, isDebugEnabled)\r
+ /*\r
+ String serviceInstanceData =\r
+ """<service-instance xmlns=\"${namespace}\">\r
+ <service-instance-id>${serviceInstanceId}</service-instance-id>\r
+ <service-instance-name>${serviceInstanceName}</service-instance-name>\r
+ <service-type>${aaiServiceType}</service-type>\r
+ <service-role>${aaiServiceRole}</service-role>\r
+ ${statusLine}\r
+ <model-invariant-id>${modelInvariantUuid}</model-invariant-id>\r
+ <model-version-id>${modelUuid}</model-version-id>\r
+ </service-instance>""".trim()\r
+ */\r
+ //begin only for test\r
+ String serviceInstanceData =\r
+ """<service-instance xmlns=\"${namespace}\">\r
+ <service-instance-id>${serviceInstanceId}</service-instance-id>\r
+ <service-instance-name>${serviceInstanceName}</service-instance-name>\r
+ <service-type>${aaiServiceType}</service-type>\r
+ <service-role>${aaiServiceRole}</service-role>\r
+ ${statusLine}\r
+ </service-instance>""".trim()\r
+ //end only for test\r
+ execution.setVariable("serviceInstanceData", serviceInstanceData)\r
+ utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)\r
+ utils.logAudit(serviceInstanceData)\r
+ utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)\r
+ utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)\r
+ \r
+ execution.setVariable("serviceSDNCCreate", "false")\r
+ execution.setVariable("operationStatus", "Waiting deploy resource...") \r
+\r
+ } catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception ex){\r
+ msg = "Exception in preProcessRequest " + ex.getMessage()\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
+ }\r
+ utils.log("INFO", "Exited " + method, isDebugEnabled)\r
+ }\r
+ \r
+ public void postProcessAAIGET(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)\r
+ String msg = ""\r
+\r
+ try {\r
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
+ boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")\r
+ String serviceType = ""\r
+\r
+ if(foundInAAI){\r
+ utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)\r
+\r
+ String siData = execution.getVariable("GENGS_service")\r
+ utils.log("INFO", "SI Data", isDebugEnabled)\r
+ if (isBlank(siData))\r
+ {\r
+ msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+ }\r
+ else\r
+ {\r
+ utils.log("INFO", "SI Data" + siData, isDebugEnabled)\r
+ \r
+ InputSource source = new InputSource(new StringReader(siData));\r
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\r
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()\r
+ Document serviceXml = docBuilder.parse(source)\r
+ serviceXml.getDocumentElement().normalize()\r
+ \r
+ // Get Template uuid and version\r
+ if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {\r
+ utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)\r
+ def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()\r
+ def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()\r
+ \r
+ // Set Original Template info\r
+ execution.setVariable("model-invariant-id-original", modelInvariantId)\r
+ execution.setVariable("model-version-id-original", modelVersionId) \r
+ }\r
+ \r
+ //Confirm there are no related service instances (vnf/network or volume)\r
+ if (utils.nodeExists(siData, "relationship-list")) {\r
+ utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)\r
+ \r
+ //test(siData)\r
+ NodeList nodeList = serviceXml.getElementsByTagName("relationship")\r
+ JSONArray jArray = new JSONArray()\r
+ for (int x = 0; x < nodeList.getLength(); x++) {\r
+ Node node = nodeList.item(x)\r
+ if (node.getNodeType() == Node.ELEMENT_NODE) {\r
+ Element eElement = (Element) node\r
+ def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns\r
+ if(e.equals("service-instance")){\r
+ def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()\r
+ utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)\r
+ NodeList dataList = node.getChildNodes()\r
+ if(null != dataList) {\r
+ JSONObject jObj = new JSONObject()\r
+ for (int i = 0; i < dataList.getLength(); i++) {\r
+ Node dNode = dataList.item(i)\r
+ if(dNode.getNodeName() == "relationship-data") {\r
+ Element rDataEle = (Element)dNode\r
+ def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()\r
+ def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()\r
+ if(eKey.equals("service-instance.service-instance-id")){\r
+ jObj.put("resourceInstanceId", eValue)\r
+ }\r
+ }\r
+ else if(dNode.getNodeName() == "related-to-property"){\r
+ Element rDataEle = (Element)dNode\r
+ def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()\r
+ def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()\r
+ if(eKey.equals("service-instance.service-instance-name")){\r
+ jObj.put("resourceType", eValue)\r
+ }\r
+ }\r
+ }\r
+ utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)\r
+ jArray.put(jObj)\r
+ }\r
+ //for overlay/underlay\r
+ }else if (e.equals("configuration")){\r
+ def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()\r
+ utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)\r
+ NodeList dataList = node.getChildNodes()\r
+ if(null != dataList) {\r
+ JSONObject jObj = new JSONObject()\r
+ for (int i = 0; i < dataList.getLength(); i++) {\r
+ Node dNode = dataList.item(i)\r
+ if(dNode.getNodeName() == "relationship-data") {\r
+ Element rDataEle = (Element)dNode\r
+ def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()\r
+ def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()\r
+ if(eKey.equals("configuration.configuration-id")){\r
+ jObj.put("resourceInstanceId", eValue)\r
+ }\r
+ }\r
+ else if(dNode.getNodeName() == "related-to-property"){\r
+ Element rDataEle = (Element)dNode\r
+ def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()\r
+ def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()\r
+ if(eKey.equals("configuration.configuration-type")){\r
+ jObj.put("resourceType", eValue)\r
+ }\r
+ }\r
+ }\r
+ utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)\r
+ jArray.put(jObj)\r
+ } \r
+ }\r
+ }\r
+ }\r
+ execution.setVariable("serviceRelationShip", jArray.toString())\r
+ }\r
+ }\r
+ }else{\r
+ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")\r
+ if(!succInAAI){\r
+ utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)\r
+ WorkflowException workflowException = execution.getVariable("WorkflowException")\r
+ utils.logAudit("workflowException: " + workflowException)\r
+ if(workflowException != null){\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())\r
+ }\r
+ else\r
+ {\r
+ msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)\r
+ }\r
+ }\r
+\r
+ utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)\r
+ }\r
+ }catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception ex) {\r
+ msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()\r
+ utils.log("INFO", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
+ }\r
+ utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)\r
+ }\r
+ \r
+ \r
+ public void preInitResourcesOperStatus(Execution execution){\r
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+\r
+ utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)\r
+ try{\r
+ String serviceId = execution.getVariable("serviceInstanceId")\r
+ String operationId = execution.getVariable("operationId")\r
+ String operationType = execution.getVariable("operationType")\r
+ String resourceTemplateUUIDs = ""\r
+ String result = "processing"\r
+ String progress = "0"\r
+ String reason = ""\r
+ String operationContent = "Prepare service updating"\r
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)\r
+ serviceId = UriUtils.encode(serviceId,"UTF-8")\r
+ execution.setVariable("serviceInstanceId", serviceId)\r
+ execution.setVariable("operationId", operationId)\r
+ execution.setVariable("operationType", operationType)\r
+ \r
+ String serviceRelationShip = execution.getVariable("serviceRelationShip")\r
+ \r
+ def jsonSlurper = new JsonSlurper()\r
+ def jsonOutput = new JsonOutput() \r
+ List relationShipList = jsonSlurper.parseText(serviceRelationShip)\r
+ \r
+ if (relationShipList != null) {\r
+ relationShipList.each {\r
+ resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"\r
+ }\r
+ } \r
+ execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
+\r
+ String payload =\r
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+ xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <soapenv:Header/>\r
+ <soapenv:Body>\r
+ <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <serviceId>${serviceId}</serviceId>\r
+ <operationId>${operationId}</operationId>\r
+ <operationType>${operationType}</operationType>\r
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
+ </ns:initResourceOperationStatus>\r
+ </soapenv:Body>\r
+ </soapenv:Envelope>"""\r
+\r
+ payload = utils.formatXml(payload)\r
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)\r
+\r
+ }catch(Exception e){\r
+ utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)\r
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())\r
+ }\r
+ utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) \r
+ }\r
+ \r
+ /**\r
+ * Init the service Operation Status\r
+ */\r
+ public void preUpdateServiceOperationStatus(Execution execution){\r
+ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'\r
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+ utils.log("INFO","Entered " + method, isDebugEnabled)\r
+ \r
+ try{\r
+ String serviceId = execution.getVariable("serviceInstanceId")\r
+ String operationId = execution.getVariable("operationId")\r
+ String serviceName = execution.getVariable("serviceInstanceName")\r
+ String userId = ""\r
+ String result = "processing"\r
+ String progress = execution.getVariable("progress")\r
+ utils.log("INFO", "progress: " + progress , isDebugEnabled)\r
+ if ("100".equalsIgnoreCase(progress))\r
+ {\r
+ result = "finished"\r
+ }\r
+ String reason = ""\r
+ String operationContent = "Prepare service : " + execution.getVariable("operationStatus")\r
+ \r
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)\r
+ serviceId = UriUtils.encode(serviceId,"UTF-8")\r
+ execution.setVariable("serviceInstanceId", serviceId)\r
+ execution.setVariable("operationId", operationId)\r
+ execution.setVariable("operationType", operationType)\r
+\r
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"\r
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
+\r
+ execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
+ String payload =\r
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+ xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <soapenv:Header/>\r
+ <soapenv:Body>\r
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <serviceId>${serviceId}</serviceId>\r
+ <operationId>${operationId}</operationId>\r
+ <serviceName>${serviceName}</serviceName>\r
+ <operationType>${operationType}</operationType>\r
+ <userId>${userId}</userId>\r
+ <result>${result}</result>\r
+ <operationContent>${operationContent}</operationContent>\r
+ <progress>${progress}</progress>\r
+ <reason>${reason}</reason>\r
+ </ns:updateServiceOperationStatus>\r
+ </soapenv:Body>\r
+ </soapenv:Envelope>"""\r
+\r
+ payload = utils.formatXml(payload)\r
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)\r
+ utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)\r
+ \r
+\r
+ }catch(Exception e){\r
+ utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)\r
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())\r
+ }\r
+ utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) \r
+ utils.log("INFO", "Exited " + method, isDebugEnabled)\r
+ }\r
+ \r
+ public void postResourcesOperStatus(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ \r
+ }\r
+ \r
+ public void preCompareModelVersions(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+\r
+ }\r
+\r
+ public void postCompareModelVersions(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ }\r
+ \r
+ public void preProcessForAddResource(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+\r
+ }\r
+\r
+ public void postProcessForAddResource(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ \r
+ }\r
+ \r
+ public void preProcessForDeleteResource(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+\r
+ }\r
+\r
+ public void postProcessForDeleteResource(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ \r
+ } \r
+ \r
+ public void postConfigRequest(execution){\r
+ //now do noting\r
+ }\r
+\r
+ \r
+}\r
+ \r