Fallback for cloud region calls to AAI 13/48113/3
authorArthur Martella <am153x@att.com>
Thu, 17 May 2018 21:45:53 +0000 (17:45 -0400)
committerArthur Martella <am153x@att.com>
Fri, 18 May 2018 18:28:05 +0000 (14:28 -0400)
In the integration environment, there's no cloud region named att-aic.
Therefore, try without att-aic first (CLOUD-REGION)
and if that fails, try att-aic (DEFAULT-CLOUD-REGION)

Change-Id: Ie4a4a3924eb6fe1120519e124a7967a62c96428f
Issue-ID: INT-475
Signed-off-by: Arthur Martella <am153x@att.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy

index 39820dc..d8405aa 100644 (file)
@@ -277,11 +277,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
                                }
                        }
                                                
-                       if (cloudRegionId != null) {                    
-                               AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.DEFAULT_CLOUD_REGION, cloudRegionId)                              
+                       if (cloudRegionId != null) {
+                               String cloudOwnerId = "att-aic"; 
+                               try {
+                                   cloudOwnerId = execution.getVariable("URN_mso_default_cloud_owner_id");
+                                   if (cloudOwnerId == null) cloudOwnerId = "att-aic";
+                               } catch (RuntimeException e) {
+                                       cloudOwnerId = "att-aic"; 
+                               }
+                               
+                               AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwnerId, cloudRegionId)                                
                                // Check if this client region exists
                                if (!client.exists(cloudRegionUri)) {
-                                       logDebug("Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled)
+                                       logDebug("Cloud Region with cloudOwner ID " + cloudOwnerId + " and cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI")
                                }