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 * Modifications Copyright (c) 2019 Samsung
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.infrastructure.scripts
25 import org.onap.so.logger.ErrorCode
27 import static org.apache.commons.lang3.StringUtils.*;
29 import javax.xml.parsers.DocumentBuilder
30 import javax.xml.parsers.DocumentBuilderFactory
32 import org.apache.commons.lang3.*
33 import org.camunda.bpm.engine.delegate.BpmnError
34 import org.camunda.bpm.engine.delegate.DelegateExecution
35 import org.json.JSONArray;
36 import org.json.JSONObject;
37 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
38 import org.onap.so.bpmn.common.scripts.ExceptionUtil
39 import org.onap.so.bpmn.common.scripts.MsoUtils
40 import org.onap.so.bpmn.core.UrnPropertiesReader
41 import org.onap.so.bpmn.core.WorkflowException
42 import org.onap.so.bpmn.core.json.JsonUtils
43 import org.onap.so.logger.MessageEnum
44 import org.slf4j.Logger
45 import org.slf4j.LoggerFactory
46 import org.springframework.web.util.UriUtils;
47 import org.w3c.dom.Document
48 import org.w3c.dom.Element
49 import org.w3c.dom.Node
50 import org.w3c.dom.NodeList
51 import org.xml.sax.InputSource
52 import org.onap.so.client.aai.entities.uri.AAIResourceUri
53 import org.onap.so.client.aai.entities.uri.AAIUriFactory
54 import org.onap.so.client.aai.AAIObjectType
55 import org.onap.so.client.aai.AAIResourcesClient
62 * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
65 * @param - msoRequestId
66 * @param - globalSubscriberId - O
67 * @param - subscriptionServiceType - O
68 * @param - serviceInstanceId
69 * @param - serviceInstanceName - O
70 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
71 * @param - sdncVersion
72 * @param - failNotFound - TODO
73 * @param - serviceInputParams - TODO
76 * @param - WorkflowException
80 public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
81 private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class);
84 String Prefix="DDELSI_"
85 ExceptionUtil exceptionUtil = new ExceptionUtil()
86 JsonUtils jsonUtil = new JsonUtils()
88 public void preProcessRequest (DelegateExecution execution) {
89 logger.trace("preProcessRequest ")
93 String requestId = execution.getVariable("msoRequestId")
94 execution.setVariable("prefix",Prefix)
97 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
98 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
99 if (globalSubscriberId == null)
101 execution.setVariable("globalSubscriberId", "")
104 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
105 String serviceType = execution.getVariable("serviceType")
106 if (serviceType == null)
108 execution.setVariable("serviceType", "")
111 //Generated in parent for AAI PUT
112 String serviceInstanceId = execution.getVariable("serviceInstanceId")
113 if (isBlank(serviceInstanceId)){
114 msg = "Input serviceInstanceId is null"
116 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
119 String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
120 if (isBlank(sdncCallbackUrl)) {
121 msg = "URN_mso_workflow_sdncadapter_callback is null"
123 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
125 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
126 logger.info("SDNC Callback URL: " + sdncCallbackUrl)
128 StringBuilder sbParams = new StringBuilder()
129 Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
130 if (paramsMap != null)
132 sbParams.append("<service-input-parameters>")
133 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
135 String paramName = entry.getKey()
136 String paramValue = entry.getValue()
139 <name>${MsoUtils.xmlEscape(paramName)}</name>
140 <value>${MsoUtils.xmlEscape(paramValue)}</value>
143 sbParams.append(paramsXml)
145 sbParams.append("</service-input-parameters>")
147 String siParamsXml = sbParams.toString()
148 if (siParamsXml == null)
150 execution.setVariable("siParamsXml", siParamsXml)
152 } catch (BpmnError e) {
154 } catch (Exception ex){
155 msg = "Exception in preProcessRequest " + ex.getMessage()
157 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
159 logger.trace("Exit preProcessRequest ")
163 public void preProcessVFCDelete (DelegateExecution execution) {
166 public void postProcessVFCDelete(DelegateExecution execution, String response, String method) {
169 public void preProcessSDNCDelete (DelegateExecution execution) {
170 logger.trace("preProcessSDNCDelete ")
174 def serviceInstanceId = execution.getVariable("serviceInstanceId")
175 def serviceInstanceName = execution.getVariable("serviceInstanceName")
176 def callbackURL = execution.getVariable("sdncCallbackUrl")
177 def requestId = execution.getVariable("msoRequestId")
178 def serviceId = execution.getVariable("productFamilyId")
179 def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
180 def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
182 String serviceModelInfo = execution.getVariable("serviceModelInfo")
183 def modelInvariantUuid = ""
184 def modelVersion = ""
187 if (!isBlank(serviceModelInfo))
189 modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
190 modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
191 modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
192 modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
194 if (modelInvariantUuid == null) {
195 modelInvariantUuid = ""
197 if (modelVersion == null) {
200 if (modelUuid == null) {
203 if (modelName == null) {
207 if (serviceInstanceName == null) {
208 serviceInstanceName = ""
210 if (serviceId == null) {
214 def siParamsXml = execution.getVariable("siParamsXml")
215 def serviceType = execution.getVariable("serviceType")
216 if (serviceType == null)
221 def sdncRequestId = UUID.randomUUID().toString()
224 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
225 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
226 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
227 <sdncadapter:RequestHeader>
228 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
229 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
230 <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
231 <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
232 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
233 <sdncadapter:MsoAction>${MsoUtils.xmlEscape(serviceType)}</sdncadapter:MsoAction>
234 </sdncadapter:RequestHeader>
235 <sdncadapterworkflow:SDNCRequestData>
236 <request-information>
237 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
242 <request-action>DeleteServiceInstance</request-action>
243 </request-information>
244 <service-information>
245 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
246 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
247 <onap-model-information>
248 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
249 <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
250 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
251 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
252 </onap-model-information>
253 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
255 <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
256 </service-information>
257 <service-request-input>
258 <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
260 </service-request-input>
261 </sdncadapterworkflow:SDNCRequestData>
262 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
264 sdncDelete = utils.formatXml(sdncDelete)
265 def sdncRequestId2 = UUID.randomUUID().toString()
266 String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
267 execution.setVariable("sdncDelete", sdncDelete)
268 execution.setVariable("sdncDeactivate", sdncDeactivate)
269 logger.info("sdncDeactivate:\n" + sdncDeactivate)
270 logger.info("sdncDelete:\n" + sdncDelete)
272 } catch (BpmnError e) {
274 } catch(Exception ex) {
275 msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
277 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
279 logger.info(" *****Exit preProcessSDNCDelete *****")
282 public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) {
284 logger.trace("postProcessSDNC " + method + " ")
288 WorkflowException workflowException = execution.getVariable("WorkflowException")
289 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
290 logger.info("SDNCResponse: " + response)
291 logger.info("workflowException: " + workflowException)
293 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
294 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
295 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
296 logger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
299 msg = "Bad Response from SDNC Adapter for service-instance " + method
301 exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
303 } catch (BpmnError e) {
305 } catch(Exception ex) {
306 msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
308 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
310 logger.trace("Exit postProcessSDNC " + method + " ")
313 public void postProcessAAIGET(DelegateExecution execution) {
314 logger.trace("postProcessAAIGET ")
318 String serviceInstanceId = execution.getVariable("serviceInstanceId")
319 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
320 String serviceType = ""
323 logger.info("Found Service-instance in AAI")
325 String siData = execution.getVariable("GENGS_service")
326 logger.info("SI Data")
329 msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
331 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
335 logger.info("SI Data" + siData)
336 //Confirm there are no related service instances (vnf/network or volume)
337 if (utils.nodeExists(siData, "relationship-list")) {
338 logger.info("SI Data relationship-list exists:")
339 InputSource source = new InputSource(new StringReader(siData));
340 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
341 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
342 Document serviceXml = docBuilder.parse(source)
343 serviceXml.getDocumentElement().normalize()
345 NodeList nodeList = serviceXml.getElementsByTagName("relationship")
346 JSONArray jArray = new JSONArray()
347 for (int x = 0; x < nodeList.getLength(); x++) {
348 Node node = nodeList.item(x)
349 if (node.getNodeType() == Node.ELEMENT_NODE) {
350 Element eElement = (Element) node
351 def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
352 if(e.equals("service-instance")){
353 def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
354 logger.info("ServiceInstance Related NS :" + relatedObject)
355 NodeList dataList = node.getChildNodes()
356 if(null != dataList) {
357 JSONObject jObj = new JSONObject()
358 for (int i = 0; i < dataList.getLength(); i++) {
359 Node dNode = dataList.item(i)
360 if(dNode.getNodeName() == "relationship-data") {
361 Element rDataEle = (Element)dNode
362 def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
363 def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
364 if(eKey.equals("service-instance.service-instance-id")){
365 jObj.put("resourceInstanceId", eValue)
368 else if(dNode.getNodeName() == "related-to-property"){
369 Element rDataEle = (Element)dNode
370 def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
371 def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
372 if(eKey.equals("service-instance.service-instance-name")){
373 jObj.put("resourceType", eValue)
377 logger.info("Relationship related to Resource:" + jObj.toString())
380 //for overlay/underlay
381 }else if (e.equals("configuration")){
382 def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
383 logger.info("ServiceInstance Related Configuration :" + relatedObject)
384 NodeList dataList = node.getChildNodes()
385 if(null != dataList) {
386 JSONObject jObj = new JSONObject()
387 for (int i = 0; i < dataList.getLength(); i++) {
388 Node dNode = dataList.item(i)
389 if(dNode.getNodeName() == "relationship-data") {
390 Element rDataEle = (Element)dNode
391 def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
392 def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
393 if(eKey.equals("configuration.configuration-id")){
394 jObj.put("resourceInstanceId", eValue)
397 else if(dNode.getNodeName() == "related-to-property"){
398 Element rDataEle = (Element)dNode
399 def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
400 def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
401 if(eKey.equals("configuration.configuration-type")){
402 jObj.put("resourceType", eValue)
406 logger.info("Relationship related to Resource:" + jObj.toString())
412 execution.setVariable("serviceRelationShip", jArray.toString())
416 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
418 logger.info("Error getting Service-instance from AAI", + serviceInstanceId)
419 WorkflowException workflowException = execution.getVariable("WorkflowException")
420 logger.debug("workflowException: " + workflowException)
421 if(workflowException != null){
422 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
426 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
428 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
432 logger.info("Service-instance NOT found in AAI. Silent Success")
434 }catch (BpmnError e) {
436 } catch (Exception ex) {
437 msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
439 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
441 logger.trace("Exit postProcessAAIGET ")
445 * Deletes the service instance in aai
447 public void deleteServiceInstance(DelegateExecution execution) {
448 logger.trace("Entered deleteServiceInstance")
450 String globalCustId = execution.getVariable("globalSubscriberId")
451 String serviceType = execution.getVariable("serviceType")
452 String serviceInstanceId = execution.getVariable("serviceInstanceId")
454 AAIResourcesClient resourceClient = new AAIResourcesClient();
455 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
456 resourceClient.delete(serviceInstanceUri)
458 logger.trace("Exited deleteServiceInstance")
460 logger.debug("Error occured within deleteServiceInstance method: " + e)
461 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
465 public void preInitResourcesOperStatus(DelegateExecution execution){
466 logger.trace("STARTED preInitResourcesOperStatus Process ")
468 String serviceId = execution.getVariable("serviceInstanceId")
469 String operationId = execution.getVariable("operationId")
470 String operationType = execution.getVariable("operationType")
471 String resourceTemplateUUIDs = ""
472 String result = "processing"
473 String progress = "0"
475 String operationContent = "Prepare service creation"
476 logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
477 serviceId = UriUtils.encode(serviceId,"UTF-8")
478 execution.setVariable("serviceInstanceId", serviceId)
479 execution.setVariable("operationId", operationId)
480 execution.setVariable("operationType", operationType)
481 // we use resource instance ids for delete flow as resourceTemplateUUIDs
484 "resourceInstanceId":"1111",
485 "resourceType":"vIMS"
488 "resourceInstanceId":"222",
489 "resourceType":"vEPC"
492 "resourceInstanceId":"3333",
493 "resourceType":"overlay"
496 "resourceInstanceId":"4444",
497 "resourceType":"underlay"
500 String serviceRelationShip = execution.getVariable("serviceRelationShip")
502 def jsonSlurper = new JsonSlurper()
503 def jsonOutput = new JsonOutput()
504 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
506 if (relationShipList != null) {
507 relationShipList.each {
508 resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
512 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
513 execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
516 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
517 xmlns:ns="http://org.onap.so/requestsdb">
520 <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
521 <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
522 <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
523 <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
524 <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
525 </ns:initResourceOperationStatus>
527 </soapenv:Envelope>"""
529 payload = utils.formatXml(payload)
530 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
531 logger.info("Outgoing initResourceOperationStatus: \n" + payload)
532 logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
535 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
536 "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
537 ErrorCode.UnknownError.getValue(), e);
538 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
540 logger.trace("COMPLETED preInitResourcesOperStatus Process ")
544 * prepare delete parameters
546 public void preResourceDelete(execution, resourceName){
547 // we use resource instance ids for delete flow as resourceTemplateUUIDs
550 "resourceInstanceId":"1111",
551 "resourceType":"vIMS"
554 "resourceInstanceId":"222",
555 "resourceType":"vEPC"
558 "resourceInstanceId":"3333",
559 "resourceType":"overlay"
562 "resourceInstanceId":"4444",
563 "resourceType":"underlay"
566 logger.trace("STARTED preResourceDelete Process ")
567 String serviceRelationShip = execution.getVariable("serviceRelationShip")
568 def jsonSlurper = new JsonSlurper()
569 def jsonOutput = new JsonOutput()
570 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
572 if (relationShipList != null) {
573 relationShipList.each {
574 if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) {
575 String resourceInstanceUUID = it.resourceInstanceId
576 String resourceTemplateUUID = it.resourceInstanceId
577 execution.setVariable("resourceTemplateId", resourceTemplateUUID)
578 execution.setVariable("resourceInstanceId", resourceInstanceUUID)
579 execution.setVariable("resourceType", resourceName)
580 logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
584 logger.trace("END preResourceDelete Process ")
587 public void sequenceResource(execution){
588 logger.trace("STARTED sequenceResource Process ")
589 List<String> nsResources = new ArrayList<String>()
590 List<String> wanResources = new ArrayList<String>()
591 List<String> resourceSequence = new ArrayList<String>()
593 String serviceRelationShip = execution.getVariable("serviceRelationShip")
596 def jsonSlurper = new JsonSlurper()
597 def jsonOutput = new JsonOutput()
598 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
600 if (relationShipList != null) {
601 relationShipList.each {
602 if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){
603 wanResources.add(it.resourceType)
605 nsResources.add(it.resourceType)
609 resourceSequence.addAll(wanResources)
610 resourceSequence.addAll(nsResources)
611 String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
612 execution.setVariable("isContainsWanResource", isContainsWanResource)
613 execution.setVariable("currentResourceIndex", 0)
614 execution.setVariable("resourceSequence", resourceSequence)
615 logger.info("resourceSequence: " + resourceSequence)
616 execution.setVariable("wanResources", wanResources)
617 logger.trace("END sequenceResource Process ")
620 public void getCurrentResource(execution){
621 logger.trace("Start getCurrentResoure Process ")
622 def currentIndex = execution.getVariable("currentResourceIndex")
623 List<String> resourceSequence = execution.getVariable("resourceSequence")
624 List<String> wanResources = execution.getVariable("wanResources")
625 String resourceName = resourceSequence.get(currentIndex)
626 execution.setVariable("resourceType",resourceName)
627 if(wanResources.contains(resourceName)){
628 execution.setVariable("controllerInfo", "SDN-C")
630 execution.setVariable("controllerInfo", "VF-C")
632 logger.trace("COMPLETED getCurrentResoure Process ")
635 public void parseNextResource(execution){
636 logger.trace("Start parseNextResource Process ")
637 def currentIndex = execution.getVariable("currentResourceIndex")
638 def nextIndex = currentIndex + 1
639 execution.setVariable("currentResourceIndex", nextIndex)
640 List<String> resourceSequence = execution.getVariable("resourceSequence")
641 if(nextIndex >= resourceSequence.size()){
642 execution.setVariable("allResourceFinished", "true")
644 execution.setVariable("allResourceFinished", "false")
646 logger.trace("COMPLETED parseNextResource Process ")