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 static org.apache.commons.lang3.StringUtils.*;
27 import javax.xml.parsers.DocumentBuilder
28 import javax.xml.parsers.DocumentBuilderFactory
30 import org.apache.commons.lang3.*
31 import org.camunda.bpm.engine.delegate.BpmnError
32 import org.camunda.bpm.engine.delegate.DelegateExecution
33 import org.json.JSONArray;
34 import org.json.JSONObject;
35 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
36 import org.onap.so.bpmn.common.scripts.ExceptionUtil
37 import org.onap.so.bpmn.common.scripts.MsoUtils
38 import org.onap.so.bpmn.core.UrnPropertiesReader
39 import org.onap.so.bpmn.core.WorkflowException
40 import org.onap.so.bpmn.core.json.JsonUtils
41 import org.onap.so.logger.MessageEnum
42 import org.onap.so.logger.MsoLogger
43 import org.slf4j.Logger
44 import org.slf4j.LoggerFactory
45 import org.springframework.web.util.UriUtils;
46 import org.w3c.dom.Document
47 import org.w3c.dom.Element
48 import org.w3c.dom.Node
49 import org.w3c.dom.NodeList
50 import org.xml.sax.InputSource
51 import org.onap.so.client.aai.entities.uri.AAIResourceUri
52 import org.onap.so.client.aai.entities.uri.AAIUriFactory
53 import org.onap.so.client.aai.AAIObjectType
54 import org.onap.so.client.aai.AAIResourcesClient
61 * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
64 * @param - msoRequestId
65 * @param - globalSubscriberId - O
66 * @param - subscriptionServiceType - O
67 * @param - serviceInstanceId
68 * @param - serviceInstanceName - O
69 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
70 * @param - sdncVersion
71 * @param - failNotFound - TODO
72 * @param - serviceInputParams - TODO
75 * @param - WorkflowException
79 public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
80 private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class);
83 String Prefix="DDELSI_"
84 ExceptionUtil exceptionUtil = new ExceptionUtil()
85 JsonUtils jsonUtil = new JsonUtils()
87 public void preProcessRequest (DelegateExecution execution) {
88 logger.trace("preProcessRequest ")
92 String requestId = execution.getVariable("msoRequestId")
93 execution.setVariable("prefix",Prefix)
96 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
97 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
98 if (globalSubscriberId == null)
100 execution.setVariable("globalSubscriberId", "")
103 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
104 String serviceType = execution.getVariable("serviceType")
105 if (serviceType == null)
107 execution.setVariable("serviceType", "")
110 //Generated in parent for AAI PUT
111 String serviceInstanceId = execution.getVariable("serviceInstanceId")
112 if (isBlank(serviceInstanceId)){
113 msg = "Input serviceInstanceId is null"
115 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
118 String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
119 if (isBlank(sdncCallbackUrl)) {
120 msg = "URN_mso_workflow_sdncadapter_callback is null"
122 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
124 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
125 logger.info("SDNC Callback URL: " + sdncCallbackUrl)
127 StringBuilder sbParams = new StringBuilder()
128 Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
129 if (paramsMap != null)
131 sbParams.append("<service-input-parameters>")
132 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
134 String paramName = entry.getKey()
135 String paramValue = entry.getValue()
138 <name>${MsoUtils.xmlEscape(paramName)}</name>
139 <value>${MsoUtils.xmlEscape(paramValue)}</value>
142 sbParams.append(paramsXml)
144 sbParams.append("</service-input-parameters>")
146 String siParamsXml = sbParams.toString()
147 if (siParamsXml == null)
149 execution.setVariable("siParamsXml", siParamsXml)
151 } catch (BpmnError e) {
153 } catch (Exception ex){
154 msg = "Exception in preProcessRequest " + ex.getMessage()
156 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
158 logger.trace("Exit preProcessRequest ")
162 public void preProcessVFCDelete (DelegateExecution execution) {
165 public void postProcessVFCDelete(DelegateExecution execution, String response, String method) {
168 public void preProcessSDNCDelete (DelegateExecution execution) {
169 logger.trace("preProcessSDNCDelete ")
173 def serviceInstanceId = execution.getVariable("serviceInstanceId")
174 def serviceInstanceName = execution.getVariable("serviceInstanceName")
175 def callbackURL = execution.getVariable("sdncCallbackUrl")
176 def requestId = execution.getVariable("msoRequestId")
177 def serviceId = execution.getVariable("productFamilyId")
178 def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
179 def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
181 String serviceModelInfo = execution.getVariable("serviceModelInfo")
182 def modelInvariantUuid = ""
183 def modelVersion = ""
186 if (!isBlank(serviceModelInfo))
188 modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
189 modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
190 modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
191 modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
193 if (modelInvariantUuid == null) {
194 modelInvariantUuid = ""
196 if (modelVersion == null) {
199 if (modelUuid == null) {
202 if (modelName == null) {
206 if (serviceInstanceName == null) {
207 serviceInstanceName = ""
209 if (serviceId == null) {
213 def siParamsXml = execution.getVariable("siParamsXml")
214 def serviceType = execution.getVariable("serviceType")
215 if (serviceType == null)
220 def sdncRequestId = UUID.randomUUID().toString()
223 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
224 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
225 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
226 <sdncadapter:RequestHeader>
227 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
228 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
229 <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
230 <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
231 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
232 <sdncadapter:MsoAction>${MsoUtils.xmlEscape(serviceType)}</sdncadapter:MsoAction>
233 </sdncadapter:RequestHeader>
234 <sdncadapterworkflow:SDNCRequestData>
235 <request-information>
236 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
241 <request-action>DeleteServiceInstance</request-action>
242 </request-information>
243 <service-information>
244 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
245 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
246 <onap-model-information>
247 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
248 <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
249 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
250 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
251 </onap-model-information>
252 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
254 <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
255 </service-information>
256 <service-request-input>
257 <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
259 </service-request-input>
260 </sdncadapterworkflow:SDNCRequestData>
261 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
263 sdncDelete = utils.formatXml(sdncDelete)
264 def sdncRequestId2 = UUID.randomUUID().toString()
265 String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
266 execution.setVariable("sdncDelete", sdncDelete)
267 execution.setVariable("sdncDeactivate", sdncDeactivate)
268 logger.info("sdncDeactivate:\n" + sdncDeactivate)
269 logger.info("sdncDelete:\n" + sdncDelete)
271 } catch (BpmnError e) {
273 } catch(Exception ex) {
274 msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
276 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
278 logger.info(" *****Exit preProcessSDNCDelete *****")
281 public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) {
283 logger.trace("postProcessSDNC " + method + " ")
287 WorkflowException workflowException = execution.getVariable("WorkflowException")
288 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
289 logger.info("SDNCResponse: " + response)
290 logger.info("workflowException: " + workflowException)
292 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
293 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
294 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
295 logger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
298 msg = "Bad Response from SDNC Adapter for service-instance " + method
300 exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
302 } catch (BpmnError e) {
304 } catch(Exception ex) {
305 msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
307 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
309 logger.trace("Exit postProcessSDNC " + method + " ")
312 public void postProcessAAIGET(DelegateExecution execution) {
313 logger.trace("postProcessAAIGET ")
317 String serviceInstanceId = execution.getVariable("serviceInstanceId")
318 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
319 String serviceType = ""
322 logger.info("Found Service-instance in AAI")
324 String siData = execution.getVariable("GENGS_service")
325 logger.info("SI Data")
328 msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
330 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
334 logger.info("SI Data" + siData)
335 //Confirm there are no related service instances (vnf/network or volume)
336 if (utils.nodeExists(siData, "relationship-list")) {
337 logger.info("SI Data relationship-list exists:")
338 InputSource source = new InputSource(new StringReader(siData));
339 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
340 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
341 Document serviceXml = docBuilder.parse(source)
342 serviceXml.getDocumentElement().normalize()
344 NodeList nodeList = serviceXml.getElementsByTagName("relationship")
345 JSONArray jArray = new JSONArray()
346 for (int x = 0; x < nodeList.getLength(); x++) {
347 Node node = nodeList.item(x)
348 if (node.getNodeType() == Node.ELEMENT_NODE) {
349 Element eElement = (Element) node
350 def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
351 if(e.equals("service-instance")){
352 def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
353 logger.info("ServiceInstance Related NS :" + relatedObject)
354 NodeList dataList = node.getChildNodes()
355 if(null != dataList) {
356 JSONObject jObj = new JSONObject()
357 for (int i = 0; i < dataList.getLength(); i++) {
358 Node dNode = dataList.item(i)
359 if(dNode.getNodeName() == "relationship-data") {
360 Element rDataEle = (Element)dNode
361 def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
362 def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
363 if(eKey.equals("service-instance.service-instance-id")){
364 jObj.put("resourceInstanceId", eValue)
367 else if(dNode.getNodeName() == "related-to-property"){
368 Element rDataEle = (Element)dNode
369 def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
370 def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
371 if(eKey.equals("service-instance.service-instance-name")){
372 jObj.put("resourceType", eValue)
376 logger.info("Relationship related to Resource:" + jObj.toString())
379 //for overlay/underlay
380 }else if (e.equals("configuration")){
381 def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
382 logger.info("ServiceInstance Related Configuration :" + relatedObject)
383 NodeList dataList = node.getChildNodes()
384 if(null != dataList) {
385 JSONObject jObj = new JSONObject()
386 for (int i = 0; i < dataList.getLength(); i++) {
387 Node dNode = dataList.item(i)
388 if(dNode.getNodeName() == "relationship-data") {
389 Element rDataEle = (Element)dNode
390 def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
391 def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
392 if(eKey.equals("configuration.configuration-id")){
393 jObj.put("resourceInstanceId", eValue)
396 else if(dNode.getNodeName() == "related-to-property"){
397 Element rDataEle = (Element)dNode
398 def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
399 def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
400 if(eKey.equals("configuration.configuration-type")){
401 jObj.put("resourceType", eValue)
405 logger.info("Relationship related to Resource:" + jObj.toString())
411 execution.setVariable("serviceRelationShip", jArray.toString())
415 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
417 logger.info("Error getting Service-instance from AAI", + serviceInstanceId)
418 WorkflowException workflowException = execution.getVariable("WorkflowException")
419 logger.debug("workflowException: " + workflowException)
420 if(workflowException != null){
421 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
425 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
427 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
431 logger.info("Service-instance NOT found in AAI. Silent Success")
433 }catch (BpmnError e) {
435 } catch (Exception ex) {
436 msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
438 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
440 logger.trace("Exit postProcessAAIGET ")
444 * Deletes the service instance in aai
446 public void deleteServiceInstance(DelegateExecution execution) {
447 logger.trace("Entered deleteServiceInstance")
449 String globalCustId = execution.getVariable("globalSubscriberId")
450 String serviceType = execution.getVariable("serviceType")
451 String serviceInstanceId = execution.getVariable("serviceInstanceId")
453 AAIResourcesClient resourceClient = new AAIResourcesClient();
454 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
455 resourceClient.delete(serviceInstanceUri)
457 logger.trace("Exited deleteServiceInstance")
459 logger.debug("Error occured within deleteServiceInstance method: " + e)
460 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
464 public void preInitResourcesOperStatus(DelegateExecution execution){
465 logger.trace("STARTED preInitResourcesOperStatus Process ")
467 String serviceId = execution.getVariable("serviceInstanceId")
468 String operationId = execution.getVariable("operationId")
469 String operationType = execution.getVariable("operationType")
470 String resourceTemplateUUIDs = ""
471 String result = "processing"
472 String progress = "0"
474 String operationContent = "Prepare service creation"
475 logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
476 serviceId = UriUtils.encode(serviceId,"UTF-8")
477 execution.setVariable("serviceInstanceId", serviceId)
478 execution.setVariable("operationId", operationId)
479 execution.setVariable("operationType", operationType)
480 // we use resource instance ids for delete flow as resourceTemplateUUIDs
483 "resourceInstanceId":"1111",
484 "resourceType":"vIMS"
487 "resourceInstanceId":"222",
488 "resourceType":"vEPC"
491 "resourceInstanceId":"3333",
492 "resourceType":"overlay"
495 "resourceInstanceId":"4444",
496 "resourceType":"underlay"
499 String serviceRelationShip = execution.getVariable("serviceRelationShip")
501 def jsonSlurper = new JsonSlurper()
502 def jsonOutput = new JsonOutput()
503 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
505 if (relationShipList != null) {
506 relationShipList.each {
507 resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
511 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
512 execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
515 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
516 xmlns:ns="http://org.onap.so/requestsdb">
519 <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
520 <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
521 <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
522 <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
523 <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
524 </ns:initResourceOperationStatus>
526 </soapenv:Envelope>"""
528 payload = utils.formatXml(payload)
529 execution.setVariable("CVFMI_initResOperStatusRequest", payload)
530 logger.info("Outgoing initResourceOperationStatus: \n" + payload)
531 logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
534 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
535 "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
536 MsoLogger.ErrorCode.UnknownError.getValue(), e);
537 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
539 logger.trace("COMPLETED preInitResourcesOperStatus Process ")
543 * prepare delete parameters
545 public void preResourceDelete(execution, resourceName){
546 // we use resource instance ids for delete flow as resourceTemplateUUIDs
549 "resourceInstanceId":"1111",
550 "resourceType":"vIMS"
553 "resourceInstanceId":"222",
554 "resourceType":"vEPC"
557 "resourceInstanceId":"3333",
558 "resourceType":"overlay"
561 "resourceInstanceId":"4444",
562 "resourceType":"underlay"
565 logger.trace("STARTED preResourceDelete Process ")
566 String serviceRelationShip = execution.getVariable("serviceRelationShip")
567 def jsonSlurper = new JsonSlurper()
568 def jsonOutput = new JsonOutput()
569 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
571 if (relationShipList != null) {
572 relationShipList.each {
573 if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) {
574 String resourceInstanceUUID = it.resourceInstanceId
575 String resourceTemplateUUID = it.resourceInstanceId
576 execution.setVariable("resourceTemplateId", resourceTemplateUUID)
577 execution.setVariable("resourceInstanceId", resourceInstanceUUID)
578 execution.setVariable("resourceType", resourceName)
579 logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
583 logger.trace("END preResourceDelete Process ")
586 public void sequenceResource(execution){
587 logger.trace("STARTED sequenceResource Process ")
588 List<String> nsResources = new ArrayList<String>()
589 List<String> wanResources = new ArrayList<String>()
590 List<String> resourceSequence = new ArrayList<String>()
592 String serviceRelationShip = execution.getVariable("serviceRelationShip")
595 def jsonSlurper = new JsonSlurper()
596 def jsonOutput = new JsonOutput()
597 List relationShipList = jsonSlurper.parseText(serviceRelationShip)
599 if (relationShipList != null) {
600 relationShipList.each {
601 if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){
602 wanResources.add(it.resourceType)
604 nsResources.add(it.resourceType)
608 resourceSequence.addAll(wanResources)
609 resourceSequence.addAll(nsResources)
610 String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
611 execution.setVariable("isContainsWanResource", isContainsWanResource)
612 execution.setVariable("currentResourceIndex", 0)
613 execution.setVariable("resourceSequence", resourceSequence)
614 logger.info("resourceSequence: " + resourceSequence)
615 execution.setVariable("wanResources", wanResources)
616 logger.trace("END sequenceResource Process ")
619 public void getCurrentResource(execution){
620 logger.trace("Start getCurrentResoure Process ")
621 def currentIndex = execution.getVariable("currentResourceIndex")
622 List<String> resourceSequence = execution.getVariable("resourceSequence")
623 List<String> wanResources = execution.getVariable("wanResources")
624 String resourceName = resourceSequence.get(currentIndex)
625 execution.setVariable("resourceType",resourceName)
626 if(wanResources.contains(resourceName)){
627 execution.setVariable("controllerInfo", "SDN-C")
629 execution.setVariable("controllerInfo", "VF-C")
631 logger.trace("COMPLETED getCurrentResoure Process ")
634 public void parseNextResource(execution){
635 logger.trace("Start parseNextResource Process ")
636 def currentIndex = execution.getVariable("currentResourceIndex")
637 def nextIndex = currentIndex + 1
638 execution.setVariable("currentResourceIndex", nextIndex)
639 List<String> resourceSequence = execution.getVariable("resourceSequence")
640 if(nextIndex >= resourceSequence.size()){
641 execution.setVariable("allResourceFinished", "true")
643 execution.setVariable("allResourceFinished", "false")
645 logger.trace("COMPLETED parseNextResource Process ")