Initial OpenECOMP MSO commit
[so.git] / bpmn / MSOGammaBPMN / src / main / groovy / com / att / bpm / scripts / AaiUtil.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package com.att.bpm.scripts
22 import org.camunda.bpm.engine.delegate.BpmnError
23 import org.camunda.bpm.engine.runtime.Execution
24
25 import org.openecomp.mso.rest.APIResponse;
26 import org.openecomp.mso.rest.RESTClient
27 import org.openecomp.mso.rest.RESTConfig
28
29 class AaiUtil {
30
31         public MsoUtils utils = new MsoUtils()
32         public static final String NETWORK_GENERIC_VNF = 'aai_network_generic_vnf_uri'
33         public static final String NETWORK_VPN_BINDING = 'aai_network_vpn_binding_uri'
34         public static final String NETWORK_POLICY = 'aai_network_policy_uri'
35         public static final String NETWORK_VCE = 'aai_network_vce_uri'
36         public static final String NETWORK_L3_NETWORK = 'aai_network_l3_network_uri'
37         public static final String NETWORK_TABLE_REFERENCES = 'aai_network_table_reference_uri'
38         public static final String BUSINESS_CUSTOMER = 'aai_business_customer_uri'
39         public static final String BUSINESS_CUSTOMERV7 = 'aaiv7_business_customer_uri'
40         public static final String CLOUD_INFRASTRUCTURE_VOLUME_GROUP = 'aai_cloud_infrastructure_volume_group_uri'
41         public static final String CLOUD_INFRASTRUCTURE_CLOUD_REGION = 'aai_cloud_infrastructure_cloud_region_uri'
42         public static final String CLOUD_INFRASTRUCTURE_TENANT = 'aai_cloud_infrastructure_tenant_uri'
43         public static final String SEARCH_GENERIC_QUERY = 'aai_search_generic_query_uri'
44         public static final String SEARCH_NODES_QUERY = 'aai_search_nodes_query_uri'
45         public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/'
46
47         private AbstractServiceTaskProcessor taskProcessor
48
49         public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
50                 this.taskProcessor = taskProcessor
51         }
52         
53         public String getNetworkGenericVnfEndpoint(Execution execution) {
54                 def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' +
55                 'execution=' + execution.getId() +
56                 ')'
57                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
58                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
59
60                 String endpoint = execution.getVariable("URN_aai_endpoint")
61                 def processKey = taskProcessor.getProcessKey(execution)
62                 def uri = getUri(execution, NETWORK_GENERIC_VNF)
63
64                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
65                 return endpoint + uri
66         }
67
68         public String getNetworkGenericVnfUri(Execution execution) {
69                 def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' +
70                 'execution=' + execution.getId() +
71                 ')'
72                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
73                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
74
75                 def processKey = taskProcessor.getProcessKey(execution)
76                 def uri = getUri(execution, NETWORK_GENERIC_VNF)
77
78                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
79                 return uri
80         }
81         
82         
83
84         public String getNetworkVpnBindingUri(Execution execution) {
85                 def method = getClass().getSimpleName() + '.getNetworkVpnBindingUri(' +
86                 'execution=' + execution.getId() +
87                 ')'
88                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
89                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
90
91                 def processKey = taskProcessor.getProcessKey(execution)
92                 def uri = getUri(execution, NETWORK_VPN_BINDING)
93
94                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
95                 return uri
96         }
97
98         public String getNetworkPolicyUri(Execution execution) {
99                 def method = getClass().getSimpleName() + '.getNetworkPolicyUri(' +
100                 'execution=' + execution.getId() +
101                 ')'
102                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
103                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
104
105                 def processKey = taskProcessor.getProcessKey(execution)
106                 def uri = getUri(execution, NETWORK_POLICY)
107
108                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
109                 return uri
110         }
111
112         public String getNetworkTableReferencesUri(Execution execution) {
113                 def method = getClass().getSimpleName() + '.getNetworkTableReferencesUri(' +
114                 'execution=' + execution.getId() +
115                 ')'
116                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
117                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
118
119                 def processKey = taskProcessor.getProcessKey(execution)
120                 def uri = getUri(execution, NETWORK_TABLE_REFERENCES)
121
122                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
123                 return uri
124         }
125         
126         public String getNetworkVceUri(Execution execution) {
127                 def method = getClass().getSimpleName() + '.getNetworkVceUri(' +
128                 'execution=' + execution.getId() +
129                 ')'
130                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
131                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
132
133                 def processKey = taskProcessor.getProcessKey(execution)
134                 def uri = getUri(execution, NETWORK_VCE)
135
136                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
137                 return uri
138         }
139
140         public String getNetworkL3NetworkUri(Execution execution) {
141                 def method = getClass().getSimpleName() + '.getNetworkL3NetworkUri(' +
142                 'execution=' + execution.getId() +
143                 ')'
144                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
145                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
146
147                 def processKey = taskProcessor.getProcessKey(execution)
148                 def uri = getUri(execution, NETWORK_L3_NETWORK)
149
150                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
151                 return uri
152         }
153
154         public String getBusinessCustomerUri(Execution execution) {
155                 def method = getClass().getSimpleName() + '.getBusinessCustomerUri(' +
156                 'execution=' + execution.getId() +
157                 ')'
158                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
159                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
160
161                 def processKey = taskProcessor.getProcessKey(execution)
162                 def uri = getUri(execution, BUSINESS_CUSTOMER)
163
164                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
165                 return uri
166         }
167
168         public String getBusinessCustomerUriv7(Execution execution) {
169                 def method = getClass().getSimpleName() + '.getBusinessCustomerUriv7(' +
170                 'execution=' + execution.getId() +
171                 ')'
172                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
173                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
174
175                 def processKey = taskProcessor.getProcessKey(execution)
176                 def uri = getUri(execution, BUSINESS_CUSTOMERV7)
177
178                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
179                 return uri
180         }
181
182         public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) {
183                 def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' +
184                 'execution=' + execution.getId() +
185                 ')'
186                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
187                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
188
189                 String endpoint = execution.getVariable("URN_aai_endpoint")
190                 
191                 def processKey = taskProcessor.getProcessKey(execution)
192                 def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION)
193
194                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
195                 return endpoint + uri
196         }
197         
198         /**
199          * This method is depracated, use getCloudInfrastructureRegionEndpoint instead
200          */
201         //@Deprecated
202         public String getCloudInfrastructureCloudRegionUri(Execution execution) {
203                 def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' +
204                 'execution=' + execution.getId() +
205                 ')'
206                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
207                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
208
209                 def processKey = taskProcessor.getProcessKey(execution)
210                 def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION)
211
212                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
213                 return uri
214         }
215
216         public String getCloudInfrastructureVolumeGroupEndpoint(Execution execution) {
217                 def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' +
218                 'execution=' + execution.getId() +
219                 ')'
220                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
221                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
222
223                 String endpoint = execution.getVariable("URN_aai_endpoint")
224                 
225                 def processKey = taskProcessor.getProcessKey(execution)
226                 def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP)
227
228                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
229                 return endpoint + uri
230         }
231         
232         public String getCloudInfrastructureVolumeGroupUri(Execution execution) {
233                 def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' +
234                 'execution=' + execution.getId() +
235                 ')'
236                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
237                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
238
239                 def processKey = taskProcessor.getProcessKey(execution)
240                 def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP)
241
242                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
243                 return uri
244         }
245
246         public String getCloudInfrastructureTenantUri(Execution execution) {
247                 def method = getClass().getSimpleName() + '.getCloudInfrastructureTenantUri(' +
248                 'execution=' + execution.getId() +
249                 ')'
250                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
251                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
252
253                 def processKey = taskProcessor.getProcessKey(execution)
254                 def uri = getUri(execution, CLOUD_INFRASTRUCTURE_TENANT)
255
256                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
257                 return uri
258         }
259
260         public String getSearchNodesQueryUri(Execution execution) {
261                 def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' +
262                 'execution=' + execution.getId() +
263                 ')'
264                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
265                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
266
267                 def processKey = taskProcessor.getProcessKey(execution)
268                 def uri = getUri(execution, SEARCH_NODES_QUERY)
269
270                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
271                 return uri
272         }
273         
274         public String getSearchNodesQueryEndpoint(Execution execution) {
275                 def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' +
276                 'execution=' + execution.getId() +
277                 ')'
278                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
279                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
280                 
281                 String endpoint = execution.getVariable("URN_aai_endpoint")
282
283                 def processKey = taskProcessor.getProcessKey(execution)
284                 def uri = getUri(execution, SEARCH_NODES_QUERY)
285
286                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
287                 return endpoint + uri
288         }
289         
290         public String getSearchGenericQueryUri(Execution execution) {
291                 def method = getClass().getSimpleName() + '.getSearchGenericQueryUri(' +
292                 'execution=' + execution.getId() +
293                 ')'
294                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
295                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
296
297                 def processKey = taskProcessor.getProcessKey(execution)
298                 def uri = getUri(execution, SEARCH_GENERIC_QUERY)
299
300                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
301                 return uri
302         }
303
304         public String getUri(Execution execution, String key) {
305                 def method = getClass().getSimpleName() + '.getUri(' +
306                 'execution=' + execution.getId() +
307                 ')'
308                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
309                 taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
310
311                 def processKey = taskProcessor.getProcessKey(execution)
312                 def uriKey = "URN_mso_workflow_${processKey}_${key}"
313                 def defaultUriKey = "URN_mso_workflow_default_${key}"
314
315                 taskProcessor.logDebug('URI Key ' + uriKey, isDebugLogEnabled)
316                 taskProcessor.logDebug('Default URI Key ' + defaultUriKey, isDebugLogEnabled)
317
318                 def uri = execution.getVariable(uriKey)
319                 if (uri == null || uri == "") {
320                         taskProcessor.logDebug("Process specific key not defined, using default key $defaultUriKey", isDebugLogEnabled)
321                         uri = execution.getVariable(defaultUriKey)
322                 }
323
324                 taskProcessor.logDebug('AAI URI is ' + uri, isDebugLogEnabled)
325                 taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
326                 return uri
327         }
328
329         public String getNamespaceFromUri(String uri) {
330                         String namespace = AAI_NAMESPACE_STRING
331                         if(uri!=null){
332                                 return namespace + uri.substring(uri.indexOf("v"),  uri.indexOf("v")+2)
333                         }else{
334                                 return namespace
335                         }
336         }
337
338
339         
340         /**
341          * This reusable method can be used for making AAI Get Calls. The url should
342          * be passed as a parameter along with the execution.  The method will
343          * return an APIResponse.
344          *
345          * @param execution
346          * @param url
347          *
348          * @return APIResponse
349          */
350         public APIResponse executeAAIGetCall(Execution execution, String url){
351                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
352                 taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
353                 try{
354                         String uuid = UUID.randomUUID()
355                         taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
356                         taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
357                                         
358                         String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
359
360                         RESTConfig config = new RESTConfig(url);
361                         RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
362
363                         if (basicAuthCred != null && !"".equals(basicAuthCred)) {
364                                 client.addAuthorizationHeader(basicAuthCred)
365                         }
366
367                         APIResponse apiResponse = client.get()
368                         return apiResponse
369
370                 }catch(Exception e){
371                         taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
372                         return e
373                 }
374                 taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
375         }
376
377         /**
378          * This reusable method can be used for making AAI httpPut Calls. The url should
379          * be passed as a parameter along with the execution and payload.  The method will
380          * return an APIResponse.
381          *
382          * @param execution
383          * @param url
384          * @param payload
385          *
386          * @return APIResponse
387          */
388         public APIResponse executeAAIPutCall(Execution execution, String url, String payload){
389                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
390                 taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
391                 try{
392                         String uuid = UUID.randomUUID()
393                         taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
394
395                         taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
396                         String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
397
398                         RESTConfig config = new RESTConfig(url);
399                         RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
400                         if (basicAuthCred != null && !"".equals(basicAuthCred)) {
401                                 client.addAuthorizationHeader(basicAuthCred)
402                         }
403                         APIResponse apiResponse = client.httpPut(payload)
404
405                         return apiResponse
406                 }catch(Exception e){
407                         taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
408                         return e
409                 }
410                 taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
411         }
412
413
414         /**
415          * This reusable method can be used for making AAI Delete Calls. The url should
416          * be passed as a parameter along with the execution.  The method will
417          * return an APIResponse.
418          *
419          * @param execution
420          * @param url
421          *
422          * @return APIResponse
423          */
424         public APIResponse executeAAIDeleteCall(Execution execution, String url){
425                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
426                 taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
427                 try{
428                         String uuid = UUID.randomUUID()
429                         taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
430
431                         taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
432                         String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
433
434                         RESTConfig config = new RESTConfig(url);
435                         RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
436                         if (basicAuthCred != null && !"".equals(basicAuthCred)) {
437                                 client.addAuthorizationHeader(basicAuthCred)
438                         }
439                         APIResponse apiResponse = client.delete()
440
441                         return apiResponse
442
443                 }catch(Exception e){
444                         taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
445                         return e
446                 }
447                 taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
448         }
449
450
451         /** Utilitty to get the Cloud Region from AAI
452          * Returns String cloud region id, (ie, cloud-region-id)
453          * @param execution
454          * @param url  - url for AAI get cloud region
455          * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
456          */
457
458         //TODO: We should refactor this method to return WorkflowException instead of Error. Also to throw MSOWorkflowException which the calling flow will then catch.
459
460         public String getAAICloudReqion(Execution execution, String url, String backend, inputCloudRegion){
461                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
462
463                 try {
464                   APIResponse apiResponse = executeAAIGetCall(execution, url)
465                   String returnCode = apiResponse.getStatusCode()
466                   String aaiResponseAsString = apiResponse.getResponseBodyAsString()
467                   taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled)
468                   execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
469                   //taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Response: " + aaiResponseAsString, isDebugEnabled)
470                   //execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionResponse", aaiResponseAsString)
471                   String regionId = ""
472                   if (returnCode == "200") {
473                          taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled)
474                            try {
475                            String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
476                            taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled)
477                            if (backend == "PO") {
478                                   regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
479                            } else { // backend not "PO"
480                                   if (regionVersion == "2.5" ) {
481                                           regionId = "AAIAIC25"
482                                   } else {
483                                           regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
484                                   }
485                            }
486
487                            taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled)
488                            return regionId
489
490                          } catch (Exception e) {
491                                   taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
492                                   return "ERROR"
493                          }
494                   } else { // not 200
495                       if (returnCode == "404") {
496                                  if (backend == "PO") {
497                                           regionId = inputCloudRegion
498                                  } else  {  // backend not "PO"
499                                           regionId = "AAIAIC25"
500                                  }
501                                  taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
502                                   return regionId
503                       } else {
504                               taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
505                               return "ERROR"
506                       }
507                   }
508                 }catch(Exception e) {
509                    taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
510                    return "ERROR"
511                 }
512         }
513
514         /* returns xml Node with service-type of searchValue */
515         def searchServiceType(xmlInput, searchValue){
516                 def fxml= new XmlSlurper().parseText(xmlInput)
517                 def ret = fxml.'**'.find {it.'service-type' == searchValue}
518                 return ret
519         }
520
521         /* returns xml Node with service-instance-id of searchValue */
522         def searchServiceInstanceId(xmlInput, searchValue){
523                 def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue}
524                 return ret
525         }
526
527
528
529 }
530