aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AaiUtil.groovy
blob: 96431b6d1f05729dc8143a44452e55c22bf72645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
/*-
 * ============LICENSE_START=======================================================
 * OPENECOMP - MSO
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package com.att.bpm.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.runtime.Execution

import org.openecomp.mso.rest.APIResponse;
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig

class AaiUtil {

	public MsoUtils utils = new MsoUtils()
	public static final String NETWORK_GENERIC_VNF = 'aai_network_generic_vnf_uri'
	public static final String NETWORK_VPN_BINDING = 'aai_network_vpn_binding_uri'
	public static final String NETWORK_POLICY = 'aai_network_policy_uri'
	public static final String NETWORK_VCE = 'aai_network_vce_uri'
	public static final String NETWORK_L3_NETWORK = 'aai_network_l3_network_uri'
	public static final String NETWORK_TABLE_REFERENCES = 'aai_network_table_reference_uri'
	public static final String BUSINESS_CUSTOMER = 'aai_business_customer_uri'
	public static final String BUSINESS_CUSTOMERV7 = 'aaiv7_business_customer_uri'
	public static final String CLOUD_INFRASTRUCTURE_VOLUME_GROUP = 'aai_cloud_infrastructure_volume_group_uri'
	public static final String CLOUD_INFRASTRUCTURE_CLOUD_REGION = 'aai_cloud_infrastructure_cloud_region_uri'
	public static final String CLOUD_INFRASTRUCTURE_TENANT = 'aai_cloud_infrastructure_tenant_uri'
	public static final String SEARCH_GENERIC_QUERY = 'aai_search_generic_query_uri'
	public static final String SEARCH_NODES_QUERY = 'aai_search_nodes_query_uri'
	public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/'

	private AbstractServiceTaskProcessor taskProcessor

	public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
		this.taskProcessor = taskProcessor
	}
	
	public String getNetworkGenericVnfEndpoint(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		String endpoint = execution.getVariable("URN_aai_endpoint")
		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_GENERIC_VNF)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return endpoint + uri
	}

	public String getNetworkGenericVnfUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_GENERIC_VNF)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}
	
	

	public String getNetworkVpnBindingUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkVpnBindingUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_VPN_BINDING)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getNetworkPolicyUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkPolicyUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_POLICY)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getNetworkTableReferencesUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkTableReferencesUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_TABLE_REFERENCES)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}
	
	public String getNetworkVceUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkVceUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_VCE)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getNetworkL3NetworkUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getNetworkL3NetworkUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, NETWORK_L3_NETWORK)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getBusinessCustomerUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getBusinessCustomerUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, BUSINESS_CUSTOMER)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getBusinessCustomerUriv7(Execution execution) {
		def method = getClass().getSimpleName() + '.getBusinessCustomerUriv7(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, BUSINESS_CUSTOMERV7)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) {
		def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		String endpoint = execution.getVariable("URN_aai_endpoint")
		
		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return endpoint + uri
	}
	
	/**
	 * This method is depracated, use getCloudInfrastructureRegionEndpoint instead
	 */
	//@Deprecated
	public String getCloudInfrastructureCloudRegionUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getCloudInfrastructureVolumeGroupEndpoint(Execution execution) {
		def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		String endpoint = execution.getVariable("URN_aai_endpoint")
		
		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return endpoint + uri
	}
	
	public String getCloudInfrastructureVolumeGroupUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getCloudInfrastructureTenantUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getCloudInfrastructureTenantUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, CLOUD_INFRASTRUCTURE_TENANT)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getSearchNodesQueryUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, SEARCH_NODES_QUERY)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}
	
	public String getSearchNodesQueryEndpoint(Execution execution) {
		def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
		
		String endpoint = execution.getVariable("URN_aai_endpoint")

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, SEARCH_NODES_QUERY)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return endpoint + uri
	}
	
	public String getSearchGenericQueryUri(Execution execution) {
		def method = getClass().getSimpleName() + '.getSearchGenericQueryUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uri = getUri(execution, SEARCH_GENERIC_QUERY)

		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getUri(Execution execution, String key) {
		def method = getClass().getSimpleName() + '.getUri(' +
		'execution=' + execution.getId() +
		')'
		def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
		taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)

		def processKey = taskProcessor.getProcessKey(execution)
		def uriKey = "URN_mso_workflow_${processKey}_${key}"
		def defaultUriKey = "URN_mso_workflow_default_${key}"

		taskProcessor.logDebug('URI Key ' + uriKey, isDebugLogEnabled)
		taskProcessor.logDebug('Default URI Key ' + defaultUriKey, isDebugLogEnabled)

		def uri = execution.getVariable(uriKey)
		if (uri == null || uri == "") {
			taskProcessor.logDebug("Process specific key not defined, using default key $defaultUriKey", isDebugLogEnabled)
			uri = execution.getVariable(defaultUriKey)
		}

		taskProcessor.logDebug('AAI URI is ' + uri, isDebugLogEnabled)
		taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
		return uri
	}

	public String getNamespaceFromUri(String uri) {
			String namespace = AAI_NAMESPACE_STRING
			if(uri!=null){
				return namespace + uri.substring(uri.indexOf("v"),  uri.indexOf("v")+2)
			}else{
				return namespace
			}
	}


	
	/**
	 * This reusable method can be used for making AAI Get Calls. The url should
	 * be passed as a parameter along with the execution.  The method will
	 * return an APIResponse.
	 *
	 * @param execution
	 * @param url
	 *
	 * @return APIResponse
	 */
	public APIResponse executeAAIGetCall(Execution execution, String url){
		def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
		taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
		try{
			String uuid = UUID.randomUUID()
			taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
			taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
					
			String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))

			RESTConfig config = new RESTConfig(url);
			RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");

			if (basicAuthCred != null && !"".equals(basicAuthCred)) {
				client.addAuthorizationHeader(basicAuthCred)
			}

			APIResponse apiResponse = client.get()
			return apiResponse

		}catch(Exception e){
			taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
			return e
		}
		taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
	}

	/**
	 * This reusable method can be used for making AAI httpPut Calls. The url should
	 * be passed as a parameter along with the execution and payload.  The method will
	 * return an APIResponse.
	 *
	 * @param execution
	 * @param url
	 * @param payload
	 *
	 * @return APIResponse
	 */
	public APIResponse executeAAIPutCall(Execution execution, String url, String payload){
		def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
		taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
		try{
			String uuid = UUID.randomUUID()
			taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)

			taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
			String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))

			RESTConfig config = new RESTConfig(url);
			RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
			if (basicAuthCred != null && !"".equals(basicAuthCred)) {
				client.addAuthorizationHeader(basicAuthCred)
			}
			APIResponse apiResponse = client.httpPut(payload)

			return apiResponse
		}catch(Exception e){
			taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
			return e
		}
		taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
	}


	/**
	 * This reusable method can be used for making AAI Delete Calls. The url should
	 * be passed as a parameter along with the execution.  The method will
	 * return an APIResponse.
	 *
	 * @param execution
	 * @param url
	 *
	 * @return APIResponse
	 */
	public APIResponse executeAAIDeleteCall(Execution execution, String url){
		def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
		taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
		try{
			String uuid = UUID.randomUUID()
			taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)

			taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
			String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))

			RESTConfig config = new RESTConfig(url);
			RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
			if (basicAuthCred != null && !"".equals(basicAuthCred)) {
				client.addAuthorizationHeader(basicAuthCred)
			}
			APIResponse apiResponse = client.delete()

			return apiResponse

		}catch(Exception e){
			taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
			return e
		}
		taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
	}


	/** Utilitty to get the Cloud Region from AAI
	 * Returns String cloud region id, (ie, cloud-region-id)
	 * @param execution
	 * @param url  - url for AAI get cloud region
	 * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
	 */

	//TODO: We should refactor this method to return WorkflowException instead of Error. Also to throw MSOWorkflowException which the calling flow will then catch.

	public String getAAICloudReqion(Execution execution, String url, String backend, inputCloudRegion){
		def isDebugEnabled = execution.getVariable("isDebugLogEnabled")

		try {
		  APIResponse apiResponse = executeAAIGetCall(execution, url)
		  String returnCode = apiResponse.getStatusCode()
		  String aaiResponseAsString = apiResponse.getResponseBodyAsString()
		  taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled)
		  execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
		  //taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Response: " + aaiResponseAsString, isDebugEnabled)
		  //execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionResponse", aaiResponseAsString)
		  String regionId = ""
		  if (returnCode == "200") {
			 taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled)
			   try {
			   String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
			   taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled)
			   if (backend == "PO") {
				  regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
			   } else { // backend not "PO"
				  if (regionVersion == "2.5" ) {
					  regionId = "AAIAIC25"
				  } else {
					  regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
				  }
			   }

			   taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled)
			   return regionId

			 } catch (Exception e) {
				  taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
				  return "ERROR"
			 }
		  } else { // not 200
		      if (returnCode == "404") {
				 if (backend == "PO") {
					  regionId = inputCloudRegion
				 } else  {  // backend not "PO"
					  regionId = "AAIAIC25"
				 }
				 taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
				  return regionId
		      } else {
			      taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
			      return "ERROR"
		      }
		  }
		}catch(Exception e) {
		   taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
		   return "ERROR"
		}
	}

	/* returns xml Node with service-type of searchValue */
	def searchServiceType(xmlInput, searchValue){
		def fxml= new XmlSlurper().parseText(xmlInput)
		def ret = fxml.'**'.find {it.'service-type' == searchValue}
		return ret
	}

	/* returns xml Node with service-instance-id of searchValue */
	def searchServiceInstanceId(xmlInput, searchValue){
		def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue}
		return ret
	}



}