2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.bpmn.infrastructure.scripts
23 import org.json.JSONArray;
25 import static org.apache.commons.lang3.StringUtils.*;
26 import groovy.xml.XmlUtil
29 import org.openecomp.mso.bpmn.core.json.JsonUtils
30 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
31 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
32 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
33 import org.openecomp.mso.bpmn.core.WorkflowException
34 import org.openecomp.mso.rest.APIResponse;
35 import org.openecomp.mso.rest.RESTClient
36 import org.openecomp.mso.rest.RESTConfig
38 import java.util.UUID;
39 import javax.xml.parsers.DocumentBuilder
40 import javax.xml.parsers.DocumentBuilderFactory
42 import org.camunda.bpm.engine.delegate.BpmnError
43 import org.camunda.bpm.engine.runtime.Execution
44 import org.json.JSONObject;
45 import org.apache.commons.lang3.*
46 import org.apache.commons.codec.binary.Base64;
47 import org.springframework.web.util.UriUtils;
48 import org.w3c.dom.Document
49 import org.w3c.dom.Element
50 import org.w3c.dom.Node
51 import org.w3c.dom.NodeList
52 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
69 * @param - WorkflowException
73 public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
75 String Prefix="DDELSI_"
76 ExceptionUtil exceptionUtil = new ExceptionUtil()
77 JsonUtils jsonUtil = new JsonUtils()
79 public void preProcessRequest (Execution execution) {
80 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
81 utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled)
85 String requestId = execution.getVariable("msoRequestId")
86 execution.setVariable("prefix",Prefix)
89 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
90 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
91 if (globalSubscriberId == null)
93 execution.setVariable("globalSubscriberId", "")
96 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
97 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
98 if (subscriptionServiceType == null)
100 execution.setVariable("subscriptionServiceType", "")
103 //Generated in parent for AAI PUT
104 String serviceInstanceId = execution.getVariable("serviceInstanceId")
105 if (isBlank(serviceInstanceId)){
106 msg = "Input serviceInstanceId is null"
107 utils.log("DEBUG", msg, isDebugEnabled)
108 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
111 String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
112 if (isBlank(sdncCallbackUrl)) {
113 msg = "URN_mso_workflow_sdncadapter_callback is null"
114 utils.log("DEBUG", msg, isDebugEnabled)
115 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
117 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
118 utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
120 StringBuilder sbParams = new StringBuilder()
121 Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
122 if (paramsMap != null)
124 sbParams.append("<service-input-parameters>")
125 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
127 String paramName = entry.getKey()
128 String paramValue = entry.getValue()
131 <name>${paramName}</name>
132 <value>${paramValue}</value>
135 sbParams.append(paramsXml)
137 sbParams.append("</service-input-parameters>")
139 String siParamsXml = sbParams.toString()
140 if (siParamsXml == null)
142 execution.setVariable("siParamsXml", siParamsXml)
144 } catch (BpmnError e) {
146 } catch (Exception ex){
147 msg = "Exception in preProcessRequest " + ex.getMessage()
148 utils.log("DEBUG", msg, isDebugEnabled)
149 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
151 utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
155 public void preProcessVFCDelete (Execution execution) {
158 public void postProcessVFCDelete(Execution execution, String response, String method) {
161 public void preProcessSDNCDelete (Execution execution) {
162 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
163 utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled)
167 def serviceInstanceId = execution.getVariable("serviceInstanceId")
168 def serviceInstanceName = execution.getVariable("serviceInstanceName")
169 def callbackURL = execution.getVariable("sdncCallbackUrl")
170 def requestId = execution.getVariable("msoRequestId")
171 def serviceId = execution.getVariable("productFamilyId")
172 def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
173 def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
175 String serviceModelInfo = execution.getVariable("serviceModelInfo")
176 def modelInvariantUuid = ""
177 def modelVersion = ""
180 if (!isBlank(serviceModelInfo))
182 modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
183 modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
184 modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
185 modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
187 if (modelInvariantUuid == null) {
188 modelInvariantUuid = ""
190 if (modelVersion == null) {
193 if (modelUuid == null) {
196 if (modelName == null) {
200 if (serviceInstanceName == null) {
201 serviceInstanceName = ""
203 if (serviceId == null) {
207 def siParamsXml = execution.getVariable("siParamsXml")
208 def serviceType = execution.getVariable("serviceType")
209 if (serviceType == null)
214 def sdncRequestId = UUID.randomUUID().toString()
217 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
218 xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
219 xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
220 <sdncadapter:RequestHeader>
221 <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
222 <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
223 <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
224 <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
225 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
226 <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
227 </sdncadapter:RequestHeader>
228 <sdncadapterworkflow:SDNCRequestData>
229 <request-information>
230 <request-id>${requestId}</request-id>
235 <request-action>DeleteServiceInstance</request-action>
236 </request-information>
237 <service-information>
238 <service-id>${serviceId}</service-id>
239 <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
240 <onap-model-information>
241 <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
242 <model-uuid>${modelUuid}</model-uuid>
243 <model-version>${modelVersion}</model-version>
244 <model-name>${modelName}</model-name>
245 </onap-model-information>
246 <service-instance-id>${serviceInstanceId}</service-instance-id>
248 <global-customer-id>${globalSubscriberId}</global-customer-id>
249 </service-information>
250 <service-request-input>
251 <service-instance-name>${serviceInstanceName}</service-instance-name>
253 </service-request-input>
254 </sdncadapterworkflow:SDNCRequestData>
255 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
257 sdncDelete = utils.formatXml(sdncDelete)
258 def sdncRequestId2 = UUID.randomUUID().toString()
259 String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
260 execution.setVariable("sdncDelete", sdncDelete)
261 execution.setVariable("sdncDeactivate", sdncDeactivate)
262 utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
263 utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled)
265 } catch (BpmnError e) {
267 } catch(Exception ex) {
268 msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
269 utils.log("DEBUG", msg, isDebugEnabled)
270 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
272 utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled)
275 public void postProcessSDNCDelete(Execution execution, String response, String method) {
277 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
278 utils.log("DEBUG"," ***** postProcessSDNC " + method + " *****", isDebugEnabled)
282 WorkflowException workflowException = execution.getVariable("WorkflowException")
283 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
284 utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled)
285 utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled)
287 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
288 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
289 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
290 utils.log("DEBUG","Good response from SDNC Adapter for service-instance " + method + "response:\n" + response, isDebugEnabled)
293 msg = "Bad Response from SDNC Adapter for service-instance " + method
294 utils.log("DEBUG", msg, isDebugEnabled)
295 exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
297 } catch (BpmnError e) {
299 } catch(Exception ex) {
300 msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
301 utils.log("DEBUG", msg, isDebugEnabled)
302 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
304 utils.log("DEBUG"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled)
307 public void postProcessAAIGET(Execution execution) {
308 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
309 utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled)
313 String serviceInstanceId = execution.getVariable("serviceInstanceId")
314 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
315 String serviceType = ""
317 if(foundInAAI == true){
318 utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled)
320 //Extract GlobalSubscriberId
321 String siRelatedLink = execution.getVariable("GENGS_siResourceLink")
322 if (isBlank(siRelatedLink))
324 msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
325 utils.log("DEBUG", msg, isDebugEnabled)
326 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
330 utils.log("DEBUG","Found Service-instance in AAI. link: " + siRelatedLink, isDebugEnabled)
331 String globalSubscriberId = execution.getVariable("globalSubscriberId")
332 if(isBlank(globalSubscriberId)){
333 int custStart = siRelatedLink.indexOf("customer/")
334 int custEnd = siRelatedLink.indexOf("/service-subscriptions")
335 globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd)
336 execution.setVariable("globalSubscriberId", globalSubscriberId)
339 //Extract Service Type if not provided on request
340 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
341 if(isBlank(subscriptionServiceType)){
342 int serviceStart = siRelatedLink.indexOf("service-subscription/")
343 int serviceEnd = siRelatedLink.indexOf("/service-instances/")
344 String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd)
345 subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8")
346 execution.setVariable("subscriptionServiceType", subscriptionServiceType)
349 if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType))
351 msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId
352 utils.log("DEBUG", msg, isDebugEnabled)
353 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
357 String siData = execution.getVariable("GENGS_service")
358 utils.log("DEBUG", "SI Data", isDebugEnabled)
361 msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
362 utils.log("DEBUG", msg, isDebugEnabled)
363 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
367 utils.log("DEBUG", "SI Data" + siData, isDebugEnabled)
368 serviceType = utils.getNodeText1(siData,"service-type")
369 execution.setVariable("serviceType", serviceType)
370 execution.setVariable("serviceRole", utils.getNodeText1(siData,"service-role"))
371 String orchestrationStatus = utils.getNodeText1(siData,"orchestration-status")
373 //Confirm there are no related service instances (vnf/network or volume)
374 if (utils.nodeExists(siData, "relationship-list")) {
375 utils.log("DEBUG", "SI Data relationship-list exists:", isDebugEnabled)
376 InputSource source = new InputSource(new StringReader(siData));
377 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
378 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
379 Document serviceXml = docBuilder.parse(source)
380 serviceXml.getDocumentElement().normalize()
382 NodeList nodeList = serviceXml.getElementsByTagName("relationship")
383 for (int x = 0; x < nodeList.getLength(); x++) {
384 Node node = nodeList.item(x)
385 if (node.getNodeType() == Node.ELEMENT_NODE) {
386 Element eElement = (Element) node
387 def e = eElement.getElementsByTagName("related-to").item(0).getTextContent()
388 if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){
389 utils.log("DEBUG", "ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources", isDebugEnabled)
390 execution.setVariable("siInUse", true)
391 //there are relationship dependencies to this Service Instance
392 msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId
393 utils.log("DEBUG", msg, isDebugEnabled)
394 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
396 NodeList dataList = node.getChildNodes()
397 if(null != dataList) {
398 JSONArray jArray = new JSONArray()
399 for (int i = 0; i < dataList.getLength(); i++) {
400 Node dNode = dataList.item(i)
401 if(dNode.getNodeName() == "relationship-data") {
402 Element rDataEle = (Element)dNode
404 def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
405 def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
407 JSONObject jObj = new JSONObject()
408 jObj.put("resourceInstanceId", eKey)
409 jObj.put("resourceType", eValue)
413 execution.setVariable("serviceRelationShip", jArray)
415 utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled)
421 if ("TRANSPORT".equalsIgnoreCase(serviceType))
423 if ("PendingDelete".equals(orchestrationStatus))
425 execution.setVariable("skipDeactivate", true)
429 msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus
430 utils.log("DEBUG", msg, isDebugEnabled)
431 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
437 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
438 if(succInAAI != true){
439 utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
440 WorkflowException workflowException = execution.getVariable("WorkflowException")
441 utils.logAudit("workflowException: " + workflowException)
442 if(workflowException != null){
443 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
447 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
448 utils.log("DEBUG", msg, isDebugEnabled)
449 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
453 utils.log("DEBUG","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
455 } catch (BpmnError e) {
457 } catch (Exception ex) {
458 msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
459 utils.log("DEBUG", msg, isDebugEnabled)
460 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
462 utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
465 public void postProcessAAIDEL(Execution execution) {
466 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
467 utils.log("DEBUG"," ***** postProcessAAIDEL ***** ", isDebugEnabled)
470 String serviceInstanceId = execution.getVariable("serviceInstanceId")
471 boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
472 if(succInAAI != true){
473 msg = "Error deleting Service-instance in AAI" + serviceInstanceId
474 utils.log("DEBUG", msg, isDebugEnabled)
475 WorkflowException workflowException = execution.getVariable("WorkflowException")
476 utils.logAudit("workflowException: " + workflowException)
477 if(workflowException != null){
478 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
482 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
485 } catch (BpmnError e) {
487 } catch (Exception ex) {
488 msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage()
489 utils.log("DEBUG", msg, isDebugEnabled)
490 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
492 utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled)
495 public void preInitResourcesOperStatus(Execution execution){
496 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
498 utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
500 String serviceId = execution.getVariable("serviceInstanceId")
501 String operationId = execution.getVariable("operationId")
502 String operationType = execution.getVariable("operationType")
503 String resourceTemplateUUIDs = ""
504 String result = "processing"
505 String progress = "0"
507 String operationContent = "Prepare service creation"
508 utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
509 serviceId = UriUtils.encode(serviceId,"UTF-8")
510 execution.setVariable("serviceInstanceId", serviceId)
511 execution.setVariable("operationId", operationId)
512 execution.setVariable("operationType", operationType)
513 // we use resource instance ids for delete flow as resourceTemplateUUIDs
516 "resourceInstanceId":"1111",
517 "resourceType":"vIMS"
520 "resourceInstanceId":"222",
521 "resourceType":"vEPC"
524 "resourceInstanceId":"3333",
525 "resourceType":"overlay"
528 "resourceInstanceId":"4444",
529 "resourceType":"underlay"
532 String serviceRelationShip = execution.getVariable("serviceRelationShip")
534 def jsonSlurper = new JsonSlurper()
535 def jsonOutput = new JsonOutput()
536 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
538 if (relationShipList != null) {
539 relationShipList.each {
540 resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
544 def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint")
545 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
546 utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
549 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
550 xmlns:ns="http://org.openecomp.mso/requestsdb">
553 <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
554 <serviceId>${serviceId}</serviceId>
555 <operationId>${operationId}</operationId>
556 <operationType>${operationType}</operationType>
557 <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
558 </ns:initResourceOperationStatus>
560 </soapenv:Envelope>"""
562 payload = utils.formatXml(payload)
563 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
564 utils.log("DEBUG", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
565 utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
568 utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
569 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
571 utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
575 * prepare delete parameters
577 public void preResourceDelete(execution, resourceName){
578 // we use resource instance ids for delete flow as resourceTemplateUUIDs
581 "resourceInstanceId":"1111",
582 "resourceType":"vIMS"
585 "resourceInstanceId":"222",
586 "resourceType":"vEPC"
589 "resourceInstanceId":"3333",
590 "resourceType":"overlay"
593 "resourceInstanceId":"4444",
594 "resourceType":"underlay"
597 String serviceRelationShip = execution.getVariable("serviceRelationShip")
598 def jsonSlurper = new JsonSlurper()
599 def jsonOutput = new JsonOutput()
600 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
602 if (relationShipList != null) {
603 relationShipList.each {
604 if(resourceName.equals(it.resourceType)) {
605 String resourceInstanceUUID = it.resourceInstanceId
606 String resourceTemplateUUID = it.resourceInstanceId
607 execution.setVariable("resourceTemplateId", resourceTemplateUUID)
608 execution.setVariable("resourceInstanceId", resourceInstanceUUID)
609 execution.setVariable("resourceType", resourceName)