summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-09-21 11:38:23 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-09-23 16:32:42 -0400
commit2505a543b0e45c1c3c2fe2fb8b85664b08bf2fca (patch)
tree5f1593d45f8c9a2fb2d400b8fa58dbb3e29ef671 /mso-api-handlers/mso-api-handler-infra/src/main/java
parent8d68a316f303d0fc57eb7da4fef881a26d39d439 (diff)
removed references to AAIObjectType
removed references to AAIObjectType and AAIObjectPlurals additional corrections for removal of aai object type corrected additional java files updated groovy files to match aai fluent builder style Issue-ID: SO-3259 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ifdf12fcacb34cc648548eb18b638afd06dad67a9
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java79
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java5
6 files changed, 86 insertions, 66 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index c7692cb2cc..b09d676b57 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -23,7 +23,12 @@
package org.onap.so.apihandlerinfra;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@@ -34,14 +39,13 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.*;
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
import org.onap.aai.domain.yang.v16.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.apache.http.HttpStatus;
-import org.json.JSONObject;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.camundabeans.CamundaResponse;
import org.onap.so.apihandler.common.CamundaClient;
@@ -53,6 +57,7 @@ import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceScaleRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2ESliceServiceActivateRequest;
import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
@@ -380,8 +385,9 @@ public class E2EServiceInstances {
// TODO Get the service template model version uuid from AAI.
String modelVersionId = null;
AAIResourcesClient client = new AAIResourcesClient();
- AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- e2eActReq.getGlobalSubscriberId(), e2eActReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+ AAIResourceUri url = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(e2eActReq.getGlobalSubscriberId()).serviceSubscription(e2eActReq.getServiceType())
+ .serviceInstance(instanceIdMap.get(SERVICE_ID)));
Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
if (serviceInstanceOpt.isPresent()) {
modelVersionId = serviceInstanceOpt.get().getModelVersionId();
@@ -469,8 +475,9 @@ public class E2EServiceInstances {
// TODO Get the service template model version uuid from AAI.
String modelVersionId = null;
AAIResourcesClient client = new AAIResourcesClient();
- AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- e2eDelReq.getGlobalSubscriberId(), e2eDelReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+ AAIResourceUri url = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(e2eDelReq.getGlobalSubscriberId()).serviceSubscription(e2eDelReq.getServiceType())
+ .serviceInstance(instanceIdMap.get(SERVICE_ID)));
Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
if (serviceInstanceOpt.isPresent()) {
modelVersionId = serviceInstanceOpt.get().getModelVersionId();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 70de94a3ef..d8ad82c17d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -1,7 +1,6 @@
package org.onap.so.apihandlerinfra.infra.rest;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -15,14 +14,13 @@ import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VolumeGroups;
-import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
-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.uri.AAIPluralResourceUri;
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.DSLQuery;
import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
@@ -30,6 +28,8 @@ import org.onap.aaiclient.client.graphinventory.entities.Node;
import org.onap.aaiclient.client.graphinventory.entities.Start;
import org.onap.aaiclient.client.graphinventory.entities.TraversalBuilder;
import org.onap.aaiclient.client.graphinventory.entities.__;
+import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -48,7 +48,7 @@ public class AAIDataRetrieval {
public ServiceInstance getServiceInstance(String serviceInstanceId) {
return this.getAaiResourcesClient()
.get(ServiceInstance.class,
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId))
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)))
.orElseGet(() -> {
logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
return null;
@@ -57,7 +57,9 @@ public class AAIDataRetrieval {
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
return this.getAaiResourcesClient()
- .get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
+ .get(VfModule.class,
+ AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)))
.orElseGet(() -> {
logger.debug("No Vf Module found in A&AI VnfId: {}" + ", VfModuleId: {}", vnfId, vfModuleId);
return null;
@@ -66,7 +68,8 @@ public class AAIDataRetrieval {
public GenericVnf getGenericVnf(String vnfId) {
return this.getAaiResourcesClient()
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
.orElseGet(() -> {
logger.debug("No Generic VNF found in A&AI VnfId: {}", vnfId);
return null;
@@ -74,9 +77,9 @@ public class AAIDataRetrieval {
}
public VolumeGroup getVolumeGroup(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
- AAIResultWrapper wrapper =
- this.getAaiResourcesClient().get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- .relatedTo(AAIObjectType.VOLUME_GROUP, volumeGroupId));
+ AAIResultWrapper wrapper = this.getAaiResourcesClient()
+ .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+ .relatedTo(Types.VOLUME_GROUP.getFragment(volumeGroupId)));
Optional<VolumeGroup> volume = wrapper.asBean(VolumeGroup.class);
if (volume.isPresent()) {
return volume.get();
@@ -88,7 +91,8 @@ public class AAIDataRetrieval {
public L3Network getNetwork(String networkId) {
return this.getAaiResourcesClient()
- .get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId))
+ .get(L3Network.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)))
.orElseGet(() -> {
logger.debug("No Network found in A&AI NetworkId: {}", networkId);
return null;
@@ -96,51 +100,57 @@ public class AAIDataRetrieval {
}
- public boolean isVolumeGroupRelatedToVFModule(String volumeGroupId) {
- return this.getAaiResourcesClient().exists(AAIUriFactory
- .createResourceUri(AAIObjectType.VOLUME_GROUP, volumeGroupId).relatedTo(AAIObjectPlurals.VF_MODULE));
+ public boolean isVolumeGroupRelatedToVFModule(CloudConfiguration cloudConfig, String volumeGroupId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())
+ .volumeGroup(volumeGroupId)).relatedTo(Types.VF_MODULES.getFragment()));
}
public boolean isVnfRelatedToVolumes(String vnfId) {
- return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment()));
}
public boolean isNetworkRelatedToModules(String networkId) {
- return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
- .relatedTo(AAIObjectPlurals.VF_MODULE));
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId))
+ .relatedTo(Types.VF_MODULES.getFragment()));
}
public boolean isServiceRelatedToNetworks(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- .relatedTo(AAIObjectPlurals.L3_NETWORK));
+ .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .relatedTo(Types.L3_NETWORKS.getFragment()));
}
public boolean isServiceRelatedToGenericVnf(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- .relatedTo(AAIObjectPlurals.GENERIC_VNF));
+ .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .relatedTo(Types.GENERIC_VNFS.getFragment()));
}
public boolean isServiceRelatedToConfiguration(String serviceInstanceId) {
return this.getAaiResourcesClient()
- .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- .relatedTo(AAIObjectPlurals.CONFIGURATION));
+ .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ .relatedTo(Types.CONFIGURATIONS.getFragment()));
}
public Service getService(String serviceId) {
return this.getAaiResourcesClient()
- .get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
+ .get(Service.class,
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().service(serviceId)))
+ .orElseGet(() -> {
logger.debug("No Service found in A&AI ServiceId: {}", serviceId);
return null;
});
}
public Tenant getTenant(String cloudOwner, String cloudRegion, String tenantId) {
- return this.getAaiResourcesClient()
- .get(Tenant.class,
- AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ return this.getAaiResourcesClient().get(Tenant.class, AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)))
.orElseGet(() -> {
logger.debug("No Tenant found in A&AI TenantId: {}", tenantId);
return null;
@@ -148,9 +158,9 @@ public class AAIDataRetrieval {
}
public List<LInterface> getLinterfacesOfVnf(String vnfId) {
- DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", vnfId));
- DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(startNode)
- .to(__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.L_INTERFACE).output()));
+ DSLStartNode startNode = new DSLStartNode(Types.GENERIC_VNF, __.key("vnf-id", vnfId));
+ DSLQueryBuilder<Start, Node> builder =
+ TraversalBuilder.fragment(startNode).to(__.node(Types.VSERVER).to(__.node(Types.L_INTERFACE).output()));
List<LInterface> linterfaces =
getAAIDSLQueryClient().querySingleResource(new DSLQuery(builder.build()), LInterface.class);
return linterfaces;
@@ -176,7 +186,8 @@ public class AAIDataRetrieval {
public List<VfModule> getVfModulesOfVnf(String vnfId) {
List<VfModule> vfModuleList = new ArrayList<VfModule>();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModules());
Optional<VfModules> vfModules = getAaiResourcesClient().get(VfModules.class, uri);
if (!vfModules.isPresent() || vfModules.get().getVfModule().isEmpty()) {
logger.debug("No VfModules attached to Vnf in AAI : {}", vnfId);
@@ -198,8 +209,8 @@ public class AAIDataRetrieval {
public List<VolumeGroup> getVolumeGroupsOfVnf(String vnfId) {
List<VolumeGroup> volumeGroupList = new ArrayList<VolumeGroup>();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment());
Optional<VolumeGroups> volumeGroups = getAaiResourcesClient().get(VolumeGroups.class, uri);
if (!volumeGroups.isPresent() || volumeGroups.get().getVolumeGroup().isEmpty()) {
logger.debug("No VolumeGroups attached to Vnf in AAI : {}", vnfId);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
index 6e7947bb58..edf17f363b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -29,9 +29,9 @@ 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.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
@@ -278,13 +278,13 @@ public class BpmnRequestBuilder {
String cloudOwner = null;
String lcpRegionId = null;
if (relationshipsOpt.isPresent()) {
- tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ tenantId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst()
.map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
.orElse(null);
- cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ cloudOwner = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
.orElse(null);
- lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
.orElse(null);
}
@@ -323,13 +323,13 @@ public class BpmnRequestBuilder {
String cloudOwner = null;
String lcpRegionId = null;
if (relationshipsOpt.isPresent()) {
- tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ tenantId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst()
.map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
.orElse(null);
- cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ cloudOwner = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
.orElse(null);
- lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
.orElse(null);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
index 550db19af4..3640baa942 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
@@ -25,7 +25,8 @@ public class VolumeGroupDeleteValidator implements RequestValidator {
@Override
public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
Map<String, String> queryParams, Actions action) {
- if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(instanceIdMap.get("volumeGroupInstanceId"))) {
+ if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(request.getRequestDetails().getCloudConfiguration(),
+ instanceIdMap.get("volumeGroupInstanceId"))) {
return Optional.of("Cannot delete volume group it is related to existing vf-modules");
} else {
return Optional.empty();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
index a28298f859..33fe9d8ae9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
@@ -27,13 +27,13 @@ import java.io.StringWriter;
import java.util.Map;
import javax.ws.rs.NotFoundException;
import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
-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.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
import org.springframework.stereotype.Component;
@@ -50,7 +50,8 @@ public class AAIClientHelper {
*/
public AAIResultWrapper getAaiOperationalEnvironment(String id) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(id));
uri.depth(Depth.ZERO);
AAIResourcesClient client = this.getClient();
return client.get(uri, NotFoundException.class);
@@ -65,7 +66,8 @@ public class AAIClientHelper {
*/
public void updateAaiOperationalEnvironment(String id, OperationalEnvironment aaiRequest) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(id));
AAIResourcesClient client = this.getClient();
client.update(uri, aaiRequest);
@@ -75,8 +77,8 @@ public class AAIClientHelper {
public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map<String, String> payload)
throws AAIClientCallFailed {
try {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironmentId);
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(operationalEnvironmentId));
AAIResourcesClient aaiClient = this.getClient();
aaiClient.update(uri, payload);
} catch (Exception ex) {
@@ -92,8 +94,8 @@ public class AAIClientHelper {
*/
public void createOperationalEnvironment(OperationalEnvironment operationalEnvironment) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT,
- operationalEnvironment.getOperationalEnvironmentId());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .operationalEnvironment(operationalEnvironment.getOperationalEnvironmentId()));
AAIResourcesClient client = this.getClient();
client.create(uri, operationalEnvironment);
}
@@ -107,10 +109,10 @@ public class AAIClientHelper {
*/
public void createRelationship(String managingEcompOperationalEnvironmentId, String vnfOperationalEnvironmentId) {
- AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT,
- managingEcompOperationalEnvironmentId);
- AAIResourceUri vnfEnvUri =
- AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, vnfOperationalEnvironmentId);
+ AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .operationalEnvironment(managingEcompOperationalEnvironmentId));
+ AAIResourceUri vnfEnvUri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(vnfOperationalEnvironmentId));
AAIResourcesClient client = this.getClient();
client.connect(vnfEnvUri, ecompEnvUri);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index d4c66f62e4..42d5af7feb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -26,11 +26,11 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.onap.aai.domain.yang.OperationalEnvironment;
-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.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -94,8 +94,7 @@ public class ActivateVnfOperationalEnvironment {
Optional<Relationships> optRelationships = wrapper.getRelationships();
if (optRelationships.isPresent()) {
Relationships relationships = optRelationships.get();
- List<AAIResourceUri> operationalEnvironments =
- relationships.getRelatedAAIUris(AAIObjectType.OPERATIONAL_ENVIRONMENT);
+ List<AAIResourceUri> operationalEnvironments = relationships.getRelatedUris(Types.OPERATIONAL_ENVIRONMENT);
if (!operationalEnvironments.isEmpty()) {
ecompOperationalEnvironmentId = operationalEnvironments.get(0).getURIKeys().get(
AAIFluentTypeBuilder.Types.OPERATIONAL_ENVIRONMENT.getUriParams().operationalEnvironmentId);