diff options
author | Steve Smokowski <ss835w@att.com> | 2019-06-07 17:38:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-07 17:38:26 +0000 |
commit | 045294cc45d32bcf6086e2456488e7bedb897e72 (patch) | |
tree | 74f017815f9ec4a6f7c30d9dab0b9e619306e904 /bpmn/so-bpmn-tasks/src/main/java | |
parent | 18029185dc1f6c79fc2927dcb92a9a4b618f9366 (diff) | |
parent | 0b9b0b6b91d9926218786c93438d903f554b4a4f (diff) |
Merge "Enhance naming service support"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java index df22cfdc26..155455e654 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java @@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks; - import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.Zone; @@ -89,7 +88,6 @@ public class NamingServiceCreateTasks { namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy()); namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName()); namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion()); - namingRequestObject.setZoneIdValue(this.getRelatedZoneId(execution)); String generatedWanTransportServiceName = ""; try { @@ -122,44 +120,4 @@ public class NamingServiceCreateTasks { } serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName); } - - protected String getRelatedZoneId(BuildingBlockExecution execution) { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - String cloudRegionId = gBBInput.getCloudRegion().getLcpCloudRegionId(); - String cloudOwner = gBBInput.getCloudRegion().getCloudOwner(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, cloudRegionId); - AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); - Optional<Relationships> relationshipsOp = this.getRelationshipsFromWrapper(vnfcResultsWrapper); - Zone aaiZone = getRelatedZone(relationshipsOp); - if (aaiZone == null) { - String errMsg = "No relationships for Cloud Region in AAI to extract zone id"; - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errMsg); - } - return aaiZone.getZoneId(); - } - - protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) { - Optional<Relationships> relationshipsOp; - relationshipsOp = wrapper.getRelationships(); - if (relationshipsOp.isPresent()) { - return relationshipsOp; - } - return Optional.empty(); - } - - protected org.onap.aai.domain.yang.Zone getRelatedZone(Optional<Relationships> relationshipsOp) { - Zone aaiZone = null; - if (relationshipsOp.isPresent()) { - Relationships relationships = relationshipsOp.get(); - if (!relationships.getAll().isEmpty()) { - List<AAIResultWrapper> zones = relationships.getByType(AAIObjectType.ZONE); - AAIResultWrapper zoneWrapper = zones.get(0); - Optional<Zone> aaiZoneOp = zoneWrapper.asBean(Zone.class); - if (aaiZoneOp.isPresent()) { - aaiZone = aaiZoneOp.get(); - } - } - } - return aaiZone; - } } |