diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
20 files changed, 387 insertions, 324 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 55edf0bb6c..b55499473c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -32,6 +32,10 @@ import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -52,9 +56,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; @@ -66,7 +67,6 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; -import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -691,7 +691,8 @@ public class AAICreateTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()); uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 42fb719f89..d62fc6f50f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -27,6 +27,9 @@ import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.NetworkPolicies; import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -38,9 +41,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; @@ -279,7 +279,8 @@ public class AAIDeleteTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()); uri.queryParam(networkPolicyFqdnParam, fqdn); Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri); if (oNetPolicies.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 0912cba94a..9df9dd330c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -32,15 +32,15 @@ import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.RouteTargets; import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; import org.slf4j.Logger; @@ -76,8 +76,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netBindingsUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING); List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>(); if (netBindingsUriList != null && !netBindingsUriList.isEmpty()) { @@ -115,8 +114,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netBindingsUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING); List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>(); for (AAIResourceUri netBindingUri : netBindingsUriList) { logger.info("Get Route Targests"); @@ -168,8 +166,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netPoliciesUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY); + List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedUris(Types.NETWORK_POLICY); if (!netPoliciesUriList.isEmpty()) { for (AAIResourceUri netPolicyUri : netPoliciesUriList) { @@ -201,7 +198,7 @@ public class AAIQueryTasks { throw (new Exception(ERROR_MSG)); } List<AAIResourceUri> routeTableUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE); + networkRelationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE); if (!routeTableUriList.isEmpty()) { for (AAIResourceUri routeTableUri : routeTableUriList) { @@ -241,7 +238,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET); + List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedUris(Types.SUBNET); if (!subnetsUriList.isEmpty()) { for (AAIResourceUri subnetUri : subnetsUriList) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 1f05522011..2644ae1b58 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -6,11 +6,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm; @@ -186,7 +186,7 @@ public class AppcOrchestratorPreProcessor { if (aaiRW != null && aaiRW.getRelationships().isPresent()) { Relationships relationships = aaiRW.getRelationships().get(); if (relationships != null) { - List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER); + List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER); ArrayList<String> vserverIds = new ArrayList<String>(); ArrayList<String> vserverSelfLinks = new ArrayList<String>(); for (AAIResourceUri j : vserverUris) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 70edc375c4..de2976fb80 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -30,11 +30,11 @@ import java.util.Map; import java.util.Optional; import org.json.JSONArray; import org.json.JSONObject; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.appc.client.lcm.model.Action; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -251,7 +251,7 @@ public class AppcRunTasks { return; } Relationships relationships = aaiRW.getRelationships().get(); - List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER); + List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER); JSONArray vserverIds = new JSONArray(); JSONArray vserverSelfLinks = new JSONArray(); if (vserverUris != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java index 751e91d009..f7c42b97e9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java @@ -1,6 +1,14 @@ package org.onap.so.bpmn.infrastructure.vfmodule; import java.util.Optional; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -8,14 +16,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.cloud.resource.beans.NodeType; @@ -60,15 +60,15 @@ public class CreateVFModule { } protected NodeType getNodeType(CloudRegion cloudRegion) { - AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); AAIResourcesClient client = getAAIClient(); Optional<Relationships> relationships = client.get(cloudRegionUri).getRelationships(); if (relationships.isPresent()) { AAIPluralResourceUri networkTechsGreenfieldUri = AAIUriFactory - .createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId()) - .relatedTo(AAIObjectPlurals.NETWORK_TECHNOLOGY) + .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())) + .relatedTo(Types.NETWORK_TECHNOLOGIES.getFragment()) .queryParam("network-technology-name", NodeType.GREENFIELD.getNetworkTechnologyName()); AAIResultWrapper networkTechsGreenfield = client.get(networkTechsGreenfieldUri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java index 905862880f..304cb9f4b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java @@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.L3Network; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -143,7 +143,7 @@ public class VrfValidation { AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork); if (networkWrapper.getRelationships().isPresent()) { List<AAIResourceUri> vpnBindingUris = - networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING); + networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING); if (!vpnBindingUris.isEmpty()) { Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0)) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 9b9433afdb..0f955e2851 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -50,12 +50,13 @@ import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIObjectName; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -485,16 +486,17 @@ public class WorkflowAction { } protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, - AAIObjectType type) { + AAIObjectName name) { List<T> vnfcs = new ArrayList<>(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships(); if (!relationshipsOp.isPresent()) { logger.debug("No relationships were found for vfModule in AAI"); } else { Relationships relationships = relationshipsOp.get(); - List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type); + List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(name); for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) { Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass); vnfcOp.ifPresent(vnfcs::add); @@ -503,9 +505,9 @@ public class WorkflowAction { return vnfcs; } - protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception { + protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception { T configuration = null; - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName())); AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships(); if (!relationshipsOp.isPresent()) { @@ -513,7 +515,7 @@ public class WorkflowAction { } else { Relationships relationships = relationshipsOp.get(); List<AAIResultWrapper> configurationResultWrappers = - this.getResultWrappersFromRelationships(relationships, type); + this.getResultWrappersFromRelationships(relationships, name); if (configurationResultWrappers.size() > 1) { String multipleRelationshipsError = "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations"; @@ -530,8 +532,8 @@ public class WorkflowAction { } protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships, - AAIObjectType type) { - return relationships.getByType(type); + AAIObjectName name) { + return relationships.getByType(name); } protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) { @@ -565,12 +567,12 @@ public class WorkflowAction { vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId(); } - List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, - org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC); + List<org.onap.aai.domain.yang.Vnfc> vnfcs = + getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC); for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) { WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds()); - org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc, - org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION); + org.onap.aai.domain.yang.Configuration configuration = + getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION); if (configuration == null) { logger.warn(String.format("No configuration found for VNFC %s in AAI", vnfc.getVnfcName())); continue; @@ -813,7 +815,7 @@ public class WorkflowAction { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships(); if (relationshipsOp.isPresent()) { List<AAIResultWrapper> configurationsRelatedToLocalNetwork = - relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION); + relationshipsOp.get().getByType(Types.CONFIGURATION); if (configurationsRelatedToLocalNetwork.size() > 1) { throw new VrfBondingServiceException( "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 7420df144a..5425b2a725 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -20,12 +20,23 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.EntityNotFoundException; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.aai.domain.yang.*; -import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.Vnfc; +import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aaiclient.client.aai.entities.Configuration; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner; import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; @@ -48,13 +59,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; -import javax.persistence.EntityNotFoundException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Collectors; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowActionBBTasks { @@ -421,8 +427,7 @@ public class WorkflowActionBBTasks { String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId(); - List<Vnfc> vnfcs = - workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC); + List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, Types.VNFC); logger.debug("Vnfc Size: {}", vnfcs.size()); for (Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); @@ -461,7 +466,7 @@ public class WorkflowActionBBTasks { protected String getConfigurationId(Vnfc vnfc) throws Exception { Configuration configuration = - workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION); + workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, Types.CONFIGURATION); if (configuration != null) { return configuration.getConfigurationId(); } else { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java index de674daca3..4140692b44 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java @@ -23,12 +23,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.VpnBinding; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +42,7 @@ public class WorkflowActionExtractResourcesAAI { protected BBInputSetupUtils bbInputSetupUtils; public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) { - List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION); + List<AAIResultWrapper> configurations = relationships.getByType(Types.CONFIGURATION); for (AAIResultWrapper configWrapper : configurations) { Optional<Configuration> config = configWrapper.asBean(Configuration.class); if (config.isPresent()) { @@ -53,7 +53,7 @@ public class WorkflowActionExtractResourcesAAI { } public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) { - List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> configurations = relationships.getRelatedUris(Types.VPN_BINDING); for (AAIResourceUri vpnBindingUri : configurations) { AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri); Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class); @@ -65,7 +65,7 @@ public class WorkflowActionExtractResourcesAAI { } public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) { - List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC); + List<AAIResultWrapper> vnfcs = relationships.getByType(Types.VNFC); for (AAIResultWrapper vnfcWrapper : vnfcs) { if (vnfcWrapper.getRelationships().isPresent()) { return vnfcWrapper.getRelationships(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java index 7386740c25..78c8cfb145 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java @@ -20,11 +20,11 @@ package org.onap.so.client.orchestration; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +40,7 @@ public class AAICollectionResources { public void createCollection(Collection collection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); @@ -48,13 +48,14 @@ public class AAICollectionResources { public void updateCollection(Collection collection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection); } public void deleteCollection(Collection collection) { - AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIResourceUri instanceGroupUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); injectionHelper.getAaiClient().delete(instanceGroupUri); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index a832930723..1373c2ca97 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -22,12 +22,13 @@ package org.onap.so.client.orchestration; import java.util.Optional; import javax.ws.rs.core.UriBuilder; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -47,8 +48,8 @@ public class AAIConfigurationResources { * @param configuration */ public void createConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration)); @@ -61,7 +62,8 @@ public class AAIConfigurationResources { * @return */ public Optional<org.onap.aai.domain.yang.Configuration> getConfiguration(String configurationId) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); } @@ -71,8 +73,8 @@ public class AAIConfigurationResources { * @param configuration */ public void updateConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration); } @@ -85,9 +87,10 @@ public class AAIConfigurationResources { */ public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI); } @@ -99,9 +102,9 @@ public class AAIConfigurationResources { */ public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) { AAIResourceUri vnrConfigurationUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vnrConfigurationId)); AAIResourceUri vrfConfigurationUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vrfConfigurationId)); injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri); } @@ -112,8 +115,9 @@ public class AAIConfigurationResources { * @param configurationId */ public void connectConfigurationToPnfObject(String pnfId, String configurationId) { - AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId); - AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)); + AAIResourceUri configurationUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); injectionHelper.getAaiClient().connect(configurationUri, pnfUri); } @@ -124,9 +128,10 @@ public class AAIConfigurationResources { * @param serviceInstanceId */ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI); } @@ -139,9 +144,10 @@ public class AAIConfigurationResources { */ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel); } @@ -152,8 +158,10 @@ public class AAIConfigurationResources { * @param genericVnfId */ public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId)); injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI); } @@ -165,26 +173,33 @@ public class AAIConfigurationResources { * */ public void connectConfigurationToVpnBinding(String configurationId, String vpnId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vpnBindingURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)); injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI); } public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vfModuleURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI); } public void connectConfigurationToVnfc(String configurationId, String vnfcName) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName)); injectionHelper.getAaiClient().connect(configurationURI, vnfcURI); } public void connectConfigurationToL3Network(String configurationId, String networkId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)); injectionHelper.getAaiClient().connect(configurationURI, networkURI); } @@ -194,7 +209,8 @@ public class AAIConfigurationResources { * @param configurationId */ public void deleteConfiguration(String configurationId) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); injectionHelper.getAaiClient().delete(aaiResourceUri); } @@ -204,8 +220,8 @@ public class AAIConfigurationResources { * @param configuration */ public void deleteConfiguration(Configuration configuration) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); injectionHelper.getAaiClient().delete(aaiResourceUri); } @@ -217,13 +233,13 @@ public class AAIConfigurationResources { */ public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory - .createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); + .createResourceFromExistingURI(Types.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); } public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); configuration.setOrchestrationStatus(orchestrationStatus); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); @@ -231,8 +247,8 @@ public class AAIConfigurationResources { public void updateConfigurationOrchestrationStatus(Configuration configuration, OrchestrationStatus orchestrationStatus) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name()); injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java index 05c8f7dd8f..27fa4304c4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -21,16 +21,16 @@ package org.onap.so.client.orchestration; import java.util.Optional; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -45,50 +45,52 @@ public class AAIInstanceGroupResources { public void createInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)); } public void deleteInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().delete(instanceGroupUri); } public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI); } public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel); } public boolean exists(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); return injectionHelper.getAaiClient().exists(instanceGroupUri); } public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)) .connect(instanceGroupUri, serviceInstanceURI); } public boolean checkInstanceGroupNameInUse(String instanceGroupName) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups()) .queryParam("instance-group-name", instanceGroupName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index 611d715331..2e8e50aebf 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -25,6 +25,15 @@ import org.onap.aai.domain.yang.NetworkPolicies; import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -34,16 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -58,46 +58,51 @@ public class AAINetworkResources { private AAIObjectMapper aaiObjectMapper; public void updateNetwork(L3Network network) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); injectionHelper.getAaiClient().update(networkURI, aaiL3Network); } public void updateSubnet(L3Network network, Subnet subnet) { - AAIResourceUri subnetURI = - AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId()); + AAIResourceUri subnetURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()).subnet(subnet.getSubnetId())); org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet); injectionHelper.getAaiClient().update(subnetURI, aaiSubnet); } public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI, serviceInstanceURI); } public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) { - AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)) .connect(networkURI, lineOfBusinessURI); } public void createPlatformAndConnectNetwork(Platform platform, L3Network network) { AAIResourceUri platformURI = - AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI, platformURI); } public void deleteNetwork(L3Network network) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().delete(networkURI); } @@ -122,115 +127,122 @@ public class AAINetworkResources { } public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL); AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri); return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); } public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL); return injectionHelper.getAaiClient().get(uri); } public void createNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup); } public void createNetworkCollection(Collection networkCollection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection); injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); } public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(tenantURI, networkURI); } public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(networkURI, cloudRegionURI); } public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) { AAIResourceUri netwrokCollectionInstanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI); } public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI); } public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) { AAIResourceUri networkCollectionUri = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); AAIResourceUri netwrokCollectionInstanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI); } public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES); } public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionUri = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); + Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri); } public void deleteCollection(Collection collection) { - AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIResourceUri collectionURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); injectionHelper.getAaiClient().delete(collectionURI); } public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().delete(instanceGroupURI); } public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) { NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy); String networkPolicyId = networkPolicy.getNetworkPolicyId(); - AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + AAIResourceUri netUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)); injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy); } public void deleteNetworkPolicy(String networkPolicyId) { AAIResourceUri networkPolicyURI = - AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)); injectionHelper.getAaiClient().delete(networkPolicyURI); } public boolean checkNetworkNameInUse(String networkName) { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", networkName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java index 3da17194ff..a426c39646 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java @@ -20,24 +20,25 @@ package org.onap.so.client.orchestration; -import com.google.common.base.Strings; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.onap.aai.domain.yang.RelatedToProperty; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.google.common.base.Strings; @Component public class AAIPnfResources { @@ -51,16 +52,16 @@ public class AAIPnfResources { private AAIObjectMapper aaiObjectMapper; public void createPnfAndConnectServiceInstance(Pnf pnf, ServiceInstance serviceInstance) { - AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()); + AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())); pnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf))) .connect(pnfURI, serviceInstanceURI); } public void updateOrchestrationStatusPnf(Pnf pnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()); + AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())); Pnf pnfCopy = pnf.shallowCopyId(); @@ -72,7 +73,7 @@ public class AAIPnfResources { public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception { Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai = injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName())); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()))); if (pnfFromAai.isPresent()) { checkIfPnfCanBeUsed(pnfFromAai.get()); updatePnfInAAI(pnf, pnfFromAai.get()); @@ -81,8 +82,8 @@ public class AAIPnfResources { private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) { updatePnfFields(pnf, pnfFromAai); - injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()), - pnfFromAai); + injectionHelper.getAaiClient().update( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())), pnfFromAai); logger.debug("updatePnfInAAI: {}", pnfFromAai); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index 424b3ecefa..cc99f178bd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -27,17 +27,17 @@ package org.onap.so.client.orchestration; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntities; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -53,15 +53,16 @@ public class AAIServiceInstanceResources { private AAIObjectMapper aaiObjectMapper; public boolean existsServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); return injectionHelper.getAaiClient().exists(serviceInstanceURI); } public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) { AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType()) + .serviceInstance(serviceInstance.getServiceInstanceId())); serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); @@ -74,58 +75,63 @@ public class AAIServiceInstanceResources { * @param customer */ public void createServiceSubscription(Customer customer) { - AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, - customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType()); + AAIResourceUri serviceSubscriptionURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType())); org.onap.aai.domain.yang.ServiceSubscription serviceSubscription = aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription()); injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI, Optional.of(serviceSubscription)); } public void deleteServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().delete(serviceInstanceURI); } public void createProject(Project project) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName())); org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)); } public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI, serviceInstanceURI); } public void createOwningEntity(OwningEntity owningEntity) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)); } public boolean existsOwningEntity(OwningEntity owningEntity) { - AAIResourceUri owningEntityUri = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); + AAIResourceUri owningEntityUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); return injectionHelper.getAaiClient().exists(owningEntityUri); } public boolean existsOwningEntityName(String owningEntityName) { - AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName); + AAIPluralResourceUri owningEntityUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities()) + .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); return aaiRC.exists(owningEntityUri); } public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName) throws AAIEntityNotFoundException { - AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName); + AAIPluralResourceUri owningEntityUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities()) + .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri); if (owningEntities.isPresent()) { @@ -142,19 +148,19 @@ public class AAIServiceInstanceResources { } public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI); } public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)) .connect(owningEntityURI, serviceInstanceURI); @@ -171,15 +177,15 @@ public class AAIServiceInstanceResources { } public void updateServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance); } public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) { - AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()) .queryParam("service-instance-name", serviceInstance.getServiceInstanceName()); return injectionHelper.getAaiClient().exists(uriSI); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index d5d0b0868a..72c9b7cc4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -23,16 +23,16 @@ package org.onap.so.client.orchestration; import java.util.Optional; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -48,23 +48,23 @@ public class AAIVfModuleResources { private AAIObjectMapper aaiObjectMapper; public void createVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); injectionHelper.getAaiClient().createIfNotExists(vfModuleURI, Optional.of(aaiObjectMapper.mapVfModule(vfModule))); } public void deleteVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); injectionHelper.getAaiClient().delete(vfModuleURI); } public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); vfModule.setOrchestrationStatus(orchestrationStatus); @@ -74,8 +74,8 @@ public class AAIVfModuleResources { } public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); copiedVfModule.setHeatStackId(vfModule.getHeatStackId()); @@ -84,8 +84,8 @@ public class AAIVfModuleResources { } public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn()); @@ -94,24 +94,25 @@ public class AAIVfModuleResources { } public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule); injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); - AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); + AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI); } public boolean checkNameInUse(VfModule vfModule) { boolean nameInUse = false; - AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) .queryParam("vf-module-name", vfModule.getVfModuleName()); AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index c2e84f668c..2f48b1f2f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -25,22 +25,22 @@ package org.onap.so.client.orchestration; import java.io.IOException; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.AAIRestClientImpl; import org.onap.aaiclient.client.aai.AAIValidatorImpl; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -57,37 +57,42 @@ public class AAIVnfResources { private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl(); public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf))) .connect(vnfURI, serviceInstanceURI); } public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) { AAIResourceUri platformURI = - AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI, platformURI); } public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) { - AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI, lineOfBusinessURI); } public void deleteVnf(GenericVnf vnf) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().delete(vnfURI); } public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); GenericVnf copiedVnf = vnf.shallowCopyId(); @@ -97,7 +102,8 @@ public class AAIVnfResources { } public void updateObjectVnf(GenericVnf vnf) { - AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf)); } @@ -109,7 +115,7 @@ public class AAIVnfResources { */ public Optional<org.onap.aai.domain.yang.GenericVnf> getGenericVnf(String vnfId) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))); } /** @@ -121,29 +127,32 @@ public class AAIVnfResources { public boolean checkInMaintFlag(String vnfId) { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); return vnf.isInMaint(); } public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI); } public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) { - AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(tenantURI, vnfURI); } public boolean checkVnfClosedLoopDisabledFlag(String vnfId) { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); return vnf.isIsClosedLoopDisabled(); } @@ -151,7 +160,7 @@ public class AAIVnfResources { public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); AAIRestClientImpl client = new AAIRestClientImpl(); aaiValidatorImpl.setClient(client); @@ -160,14 +169,14 @@ public class AAIVnfResources { } public boolean checkNameInUse(String vnfName) { - AAIPluralResourceUri vnfUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()) + .queryParam("vnf-name", vnfName); return injectionHelper.getAaiClient().exists(vnfUri); } public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())) + .depth(Depth.ALL); return injectionHelper.getAaiClient().get(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index 886dafe626..1fbfe8cab0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -22,15 +22,15 @@ package org.onap.so.client.orchestration; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -46,16 +46,18 @@ public class AAIVolumeGroupResources { private AAIObjectMapper aaiObjectMapper; public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup)); } public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion, OrchestrationStatus orchestrationStatus) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); volumeGroup.setOrchestrationStatus(orchestrationStatus); @@ -65,29 +67,34 @@ public class AAIVolumeGroupResources { public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) { AAIResourceUri uriGenericVnf = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId()); - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId())); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup); } public void connectVolumeGroupToTenant(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup); } public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().delete(uri); } public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); @@ -95,7 +102,7 @@ public class AAIVolumeGroupResources { } public boolean checkNameInUse(VolumeGroup volumeGroup) { - AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", volumeGroup.getVolumeGroupName()); return injectionHelper.getAaiClient().exists(volumeGroupUri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 5ce8268d55..5200be9d65 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -22,14 +22,13 @@ package org.onap.so.client.orchestration; import java.util.Optional; import org.onap.aai.domain.yang.VpnBindings; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,8 +45,8 @@ public class AAIVpnBindingResources { * @param customer */ public boolean existsCustomer(Customer customer) { - AAIResourceUri uriCustomer = - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + AAIResourceUri uriCustomer = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())); return injectionHelper.getAaiClient().exists(uriCustomer); } @@ -56,8 +55,9 @@ public class AAIVpnBindingResources { * @return */ public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) { - AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING) - .queryParam("customer-vpn-id", customerVpnId); + AAIPluralResourceUri aaiVpnBindingsResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBindings()) + .queryParam("customer-vpn-id", customerVpnId); return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri); } @@ -67,7 +67,7 @@ public class AAIVpnBindingResources { */ public void createVpnBinding(VpnBinding vpnBinding) { AAIResourceUri aaiVpnBindingResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBinding.getVpnId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnBinding.getVpnId())); injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding)); } @@ -75,8 +75,8 @@ public class AAIVpnBindingResources { * @param customer */ public void createCustomer(Customer customer) { - AAIResourceUri uriCustomer = - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + AAIResourceUri uriCustomer = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())); injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer)); } @@ -88,7 +88,7 @@ public class AAIVpnBindingResources { */ public Optional<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.VpnBinding.class, - AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId))); } @@ -97,8 +97,10 @@ public class AAIVpnBindingResources { * @param vpnId */ public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) { - AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); - AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); + AAIResourceUri customerURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)); + AAIResourceUri vpnBindingURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)); injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI); } } |