aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
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 /adapters
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 'adapters')
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java27
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java58
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java10
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml1
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java12
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java37
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java5
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java78
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java21
15 files changed, 199 insertions, 159 deletions
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
index 3995185f23..f326d92927 100644
--- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
@@ -25,11 +25,22 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import org.apache.logging.log4j.util.Strings;
-import org.onap.aai.domain.yang.*;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
+import org.onap.aai.domain.yang.RelatedToProperty;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.Vserver;
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.graphinventory.entities.uri.Depth;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.slf4j.Logger;
@@ -104,7 +115,7 @@ public class AaiConnection {
}
private List<EsrSystemInfo> receiveVnfmInternal() {
- final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
+ final AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfmList());
final Optional<EsrVnfmList> response = getResourcesClient().get(EsrVnfmList.class, resourceUri);
if (response.isPresent()) {
@@ -127,7 +138,7 @@ public class AaiConnection {
private List<EsrSystemInfo> receiveVnfmServiceUrl(final String vnfmId) {
final Optional<EsrVnfm> response = getResourcesClient().get(EsrVnfm.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)).depth(Depth.ONE));
if (response.isPresent()) {
final EsrVnfm esrVnfm = response.get();
@@ -143,8 +154,8 @@ public class AaiConnection {
}
public String receiveGenericVnfId(final String href) {
- final AAIResourceUri resourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam(SELFLINK, href);
+ final AAIPluralResourceUri resourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam(SELFLINK, href);
final Optional<GenericVnfs> response = getResourcesClient().get(GenericVnfs.class, resourceUri);
if (response.isPresent()) {
@@ -165,7 +176,7 @@ public class AaiConnection {
}
public String receiveVserverName(final String genericId) {
- final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericId);
+ final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericId));
final Optional<GenericVnf> response = getResourcesClient().get(GenericVnf.class, resourceUri);
if (response.isPresent()) {
@@ -199,7 +210,7 @@ public class AaiConnection {
private String receiveVserverNameFromParams(final String cloudOwner, final String cloudId, final String tenantId,
final String vserverId) {
final AAIResourceUri resourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudId, tenantId, vserverId);
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudId).tenant(tenantId).vserver(vserverId));
final Optional<Vserver> response = getResourcesClient().get(Vserver.class, resourceUri);
if (response.isPresent()) {
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
index d9450b3472..8f95d8ab85 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
@@ -26,8 +26,8 @@ import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
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.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.slf4j.Logger;
@@ -49,7 +49,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public GenericVnf invokeGetGenericVnf(final String vnfId) {
return aaiClientProvider.getAaiClient()
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
.orElseGet(() -> {
logger.debug("No vnf found in AAI with ID: {}", vnfId);
return null;
@@ -58,9 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public GenericVnfs invokeQueryGenericVnf(final String selfLink) {
- return aaiClientProvider.getAaiClient()
- .get(GenericVnfs.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink))
+ return aaiClientProvider.getAaiClient().get(GenericVnfs.class, AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("selflink", selfLink))
.orElseGet(() -> {
logger.debug("No vnf found in AAI with selflink: {}", selfLink);
return null;
@@ -70,7 +70,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public EsrVnfmList invokeGetVnfms() {
return aaiClientProvider.getAaiClient()
- .get(EsrVnfmList.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST)).orElseGet(() -> {
+ .get(EsrVnfmList.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfmList()))
+ .orElseGet(() -> {
logger.debug("No VNFMs in AAI");
return null;
});
@@ -79,7 +81,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public EsrVnfm invokeGetVnfm(final String vnfmId) {
return aaiClientProvider.getAaiClient()
- .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE))
+ .get(EsrVnfm.class, AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)).depth(Depth.ONE))
.orElseGet(() -> {
logger.debug("VNFM not found in AAI");
return null;
@@ -90,7 +93,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
public EsrSystemInfoList invokeGetVnfmEsrSystemInfoList(final String vnfmId) {
return aaiClientProvider.getAaiClient()
.get(EsrSystemInfoList.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VNFM_ESR_SYSTEM_INFO_LIST, vnfmId))
+ AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId).esrSystemInfoList()))
.orElseGet(() -> {
logger.debug("VNFM ESR system info list not found in AAI");
return null;
@@ -99,45 +103,47 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public void invokePatchGenericVnf(final GenericVnf vnf) {
- aaiClientProvider.getAaiClient()
- .update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()), vnf);
+ aaiClientProvider.getAaiClient().update(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())), vnf);
}
@Override
public void invokePutGenericVnfToVnfmRelationship(final GenericVnf vnf, final String vnfmId) {
- aaiClientProvider.getAaiClient().connect(AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId),
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()));
+ aaiClientProvider.getAaiClient().connect(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)),
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())));
}
@Override
public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final Vserver vserver) {
- aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
- cloudRegion, tenant, vserver.getVserverId()), vserver);
+ aaiClientProvider
+ .getAaiClient().create(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserver.getVserverId())),
+ vserver);
}
@Override
public void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion,
final String tenant, final Vserver vserver, final String vnfId) {
- aaiClientProvider.getAaiClient()
- .connect(
- AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant,
- vserver.getVserverId()),
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ aaiClientProvider.getAaiClient().connect(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserver.getVserverId())),
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
}
@Override
public void invokeDeleteVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final String vserverId) {
- aaiClientProvider.getAaiClient().delete(
- AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant, vserverId));
+ aaiClientProvider.getAaiClient().delete(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserverId)));
}
@Override
public Tenant invokeGetTenant(final String cloudOwner, final String cloudRegion, final String tenantId) {
- return aaiClientProvider.getAaiClient()
- .get(Tenant.class,
- AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ return aaiClientProvider.getAaiClient().get(Tenant.class, AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)))
.orElseGet(() -> {
logger.debug("Tenant not found in AAI");
return null;
@@ -147,8 +153,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public EsrSystemInfoList invokeGetCloudRegionEsrSystemInfoList(final String cloudOwner, final String cloudRegion) {
return aaiClientProvider
- .getAaiClient().get(EsrSystemInfoList.class, AAIUriFactory
- .createResourceUri(AAIObjectType.CLOUD_ESR_SYSTEM_INFO_LIST, cloudOwner, cloudRegion))
+ .getAaiClient().get(EsrSystemInfoList.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).esrSystemInfoList()))
.orElseGet(() -> {
logger.debug("Cloud esr system info list not found in AAI");
return null;
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
index 9aed675324..5bc4daac42 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
@@ -53,6 +53,7 @@ import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.adapters.etsisol003adapter.lcm.extclients.EtsiPackageProvider;
import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmRestTemplateConfiguration;
@@ -534,7 +535,7 @@ public class EtsiSol003AdapterControllerTest {
}
- private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+ private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
final String uriAsString;
@@ -544,12 +545,12 @@ public class EtsiSol003AdapterControllerTest {
@Override
public boolean matches(final Object item) {
- if (item instanceof AAIResourceUri) {
+ if (item instanceof AAIBaseResourceUri<?, ?>) {
if (uriAsString.endsWith("...")) {
- return ((AAIResourceUri) item).build().toString()
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString()
.startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
}
- return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
}
return false;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
index 21e56617cd..99b8c71764 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
@@ -43,7 +43,7 @@ import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest;
import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest.OperationEnum;
import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsAddResources;
@@ -224,7 +224,7 @@ public class Sol003GrantControllerTest {
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
}
- private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+ private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
final String uriAsString;
@@ -234,12 +234,12 @@ public class Sol003GrantControllerTest {
@Override
public boolean matches(final Object item) {
- if (item instanceof AAIResourceUri) {
+ if (item instanceof AAIBaseResourceUri) {
if (uriAsString.endsWith("...")) {
- return ((AAIResourceUri) item).build().toString()
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString()
.startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
}
- return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
}
return false;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
index 86eda0abfa..0d5bcd2573 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
@@ -54,6 +54,7 @@ import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Vserver;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource;
@@ -385,7 +386,7 @@ public class Sol003LcnControllerTest {
genericVnf.getRelationshipList().getRelationship().add(relationshipToVserver);
}
- private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+ private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
final String uriAsString;
@@ -395,12 +396,12 @@ public class Sol003LcnControllerTest {
@Override
public boolean matches(final Object item) {
- if (item instanceof AAIResourceUri) {
+ if (item instanceof AAIBaseResourceUri<?, ?>) {
if (uriAsString.endsWith("...")) {
- return ((AAIResourceUri) item).build().toString()
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString()
.startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
}
- return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+ return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
}
return false;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
index 01ba94ddd4..b636f6818c 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
@@ -100,6 +100,7 @@
<source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
<source>${project.basedir}/target/generated-sources/sol003-vnf-lcn/src/gen/java/main</source>
<source>${project.basedir}/target/generated-sources/sol003-vnf-grant/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/etsisol003adapter/src/gen/java/main</source>
</sources>
</configuration>
</execution>
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
index 3f2e5b23f2..442339d9fe 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
@@ -24,9 +24,9 @@ package org.onap.so.adapters.nssmf.extclients.aai;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrThirdpartySdncList;
import org.onap.aai.domain.yang.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.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,7 +47,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public EsrThirdpartySdncList invokeGetThirdPartySdncList() {
return aaiClientProvider.getAaiClient()
- .get(EsrThirdpartySdncList.class, AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_LIST))
+ .get(EsrThirdpartySdncList.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdncList()))
.orElseGet(() -> {
logger.debug("No VNFMs in AAI");
return null;
@@ -58,7 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
return aaiClientProvider.getAaiClient()
.get(EsrSystemInfoList.class,
- AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_SYSTEM_INFO_LIST, sdncId))
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId))))
.orElseGet(() -> {
logger.debug("VNFM not found in AAI");
return null;
@@ -69,8 +71,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public void invokeCreateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
String serviceInstanceId) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,
- serviceType, serviceInstanceId);
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
aaiClientProvider.getAaiClient().create(uri, nssiInstance);
}
}
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
index 67cd913b3e..f150f47f4f 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
@@ -20,6 +20,17 @@
package org.onap.so.adapters.nssmf;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
+import static org.onap.so.beans.nsmf.NetworkType.CORE;
+import static org.onap.so.beans.nsmf.ResourceSharingLevel.NON_SHARED;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.LinkedList;
@@ -56,19 +67,9 @@ import org.onap.so.beans.nsmf.NssiResponse;
import org.onap.so.beans.nsmf.PerfReq;
import org.onap.so.beans.nsmf.PerfReqEmbb;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
-import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
-import static org.onap.so.beans.nsmf.NetworkType.CORE;
-import static org.onap.so.beans.nsmf.ResourceSharingLevel.NON_SHARED;
@RunWith(SpringRunner.class)
public class NssmfAdapterRestTest {
@@ -281,7 +282,7 @@ public class NssmfAdapterRestTest {
//
@Test
public void testAllocateJsonSerDeSer() throws Exception {
- assertEquals(marshal(allocateNssi()), ALLOCATE);
+ JSONAssert.assertEquals(marshal(allocateNssi()), ALLOCATE, false);
NssiAllocateRequest all = unMarshal(ALLOCATE, NssiAllocateRequest.class);
assertNotNull(all);
assertNotNull(all.getAllocateCnNssi());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
index 2849907e38..bb2c938940 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
@@ -5,12 +5,11 @@ import java.util.Optional;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Complex;
import org.onap.aai.domain.yang.NetworkTechnologies;
-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.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -68,11 +67,12 @@ public class CloudRestImpl {
if (complex.isPresent()) {
cloudRegion.setComplexName(complex.get().getComplexName());
}
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId());
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId()));
getAaiClient().createIfNotExists(cloudRegionURI, Optional.of(cloudRegion));
if (complex.isPresent()) {
- AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ AAIResourceUri complexURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex(cloudSite.getClli()));
getAaiClient().connect(cloudRegionURI, complexURI);
}
createCloudRegionNetworkTechnologyRelationship(cloudSite, cloudRegionURI);
@@ -88,18 +88,21 @@ public class CloudRestImpl {
}
protected Optional<Complex> retrieveComplex(CloudSite cloudSite) {
- AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ AAIResourceUri complexURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex(cloudSite.getClli()));
return getAaiClient().get(Complex.class, complexURI);
}
protected void linkCloudAndTechnology(String networkTechnologyName, AAIResourceUri cloudRegionURI) {
- AAIPluralResourceUri technologyPluralUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_TECHNOLOGY)
- .queryParam("network-technology-name", networkTechnologyName);
+ AAIPluralResourceUri technologyPluralUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().networkTechnologies())
+ .queryParam("network-technology-name", networkTechnologyName);
Optional<NetworkTechnologies> networkTechnology =
getAaiClient().get(NetworkTechnologies.class, technologyPluralUri);
if (networkTechnology.isPresent()) {
- AAIResourceUri networkTechnologyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_TECHNOLOGY,
- networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId());
+ AAIResourceUri networkTechnologyURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().networkTechnology(
+ networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId()));
getAaiClient().connect(cloudRegionURI, networkTechnologyURI);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
index 1445622357..6f87b6b309 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
@@ -27,12 +27,13 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
import org.onap.aaiclient.client.aai.AAIObjectType;
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.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
@@ -49,20 +50,20 @@ public class AuditVServer extends AbstractAudit {
public void auditVservers(AAIObjectAuditList aaiObjectAuditList) {
aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> {
- boolean vserverExist = getAaiClient().exists(AAIUriFactory
- .createResourceFromExistingURI(AAIObjectType.VSERVER, aaiObjectAudit.getResourceURI()));
+ boolean vserverExist = getAaiClient().exists(
+ AAIUriFactory.createResourceFromExistingURI(Types.VSERVER, aaiObjectAudit.getResourceURI()));
aaiObjectAudit.setDoesObjectExist(vserverExist);
});
}
public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
- .queryParam("vf-module-name", vfModuleName);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModules())
+ .queryParam("vf-module-name", vfModuleName);
Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
- List<AAIResourceUri> relatedVservers =
- wrapper.get().getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ List<AAIResourceUri> relatedVservers = wrapper.get().getRelationships().get().getRelatedUris(Types.VSERVER);
if (!relatedVservers.isEmpty()) {
relatedVservers.forEach(vserverUri -> {
Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
@@ -70,7 +71,7 @@ public class AuditVServer extends AbstractAudit {
BeanUtils.copyProperties(vserver, vServerShallow);
AAIObjectAudit vServerAudit = new AAIObjectAudit();
vServerAudit.setAaiObject(vServerShallow);
- vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
vServerAudit.setDoesObjectExist(true);
auditList.getAuditList().add(vServerAudit);
});
@@ -103,8 +104,8 @@ public class AuditVServer extends AbstractAudit {
String cloudRegion) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
AAIObjectAudit vServerAudit = new AAIObjectAudit();
- AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
- tenantId, vServer.getVserverId());
+ AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()));
Vserver vServerShallow = new Vserver();
BeanUtils.copyProperties(vServer, vServerShallow, "LInterfaces");
boolean vServerExists = getAaiClient().exists(vserverURI);
@@ -112,7 +113,7 @@ public class AuditVServer extends AbstractAudit {
vServerAudit.setAaiObject(vServerShallow);
vServerAudit.setDoesObjectExist(vServerExists);
vServerAudit.setResourceURI(vserverURI.build());
- vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
auditList.getAuditList().add(vServerAudit);
if (vServer.getLInterfaces() != null) {
vServer.getLInterfaces().getLInterface().stream().forEach(lInterface -> auditList.getAuditList().addAll(
@@ -126,8 +127,9 @@ public class AuditVServer extends AbstractAudit {
String cloudOwner, String cloudRegion) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
AAIObjectAudit lInterfaceAudit = new AAIObjectAudit();
- AAIResourceUri linterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, vServerId, lInterface.getInterfaceName());
+ AAIResourceUri linterfaceURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver(vServerId).lInterface(lInterface.getInterfaceName()));
Optional<LInterface> queriedLInterface = getAaiClient().get(LInterface.class, linterfaceURI);
if (queriedLInterface.isPresent()) {
lInterfaceAudit.setDoesObjectExist(true);
@@ -135,7 +137,7 @@ public class AuditVServer extends AbstractAudit {
}
lInterfaceAudit.setAaiObject(lInterface);
lInterfaceAudit.setResourceURI(linterfaceURI.build());
- lInterfaceAudit.setAaiObjectType(AAIObjectType.L_INTERFACE.typeName());
+ lInterfaceAudit.setAaiObjectType(Types.L_INTERFACE.typeName());
auditList.getAuditList().add(lInterfaceAudit);
logger.info("l-interface id:{} name: {} exists: {} ", lInterface.getInterfaceId(),
lInterface.getInterfaceName(), lInterfaceAudit.isDoesObjectExist());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index 3ff15ffe2f..c58e568ea4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -37,8 +37,9 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
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.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -260,10 +261,12 @@ public class HeatStackAudit {
Vserver vServerShallow = new Vserver();
BeanUtils.copyProperties(vServer, vServerShallow);
aaiObjectAudit.setAaiObject(vServerShallow);
- aaiObjectAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
- aaiObjectAudit.setResourceURI(AAIUriFactory
- .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, vServer.getVserverId())
- .build());
+ aaiObjectAudit.setAaiObjectType(Types.VSERVER.typeName());
+ aaiObjectAudit
+ .setResourceURI(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()))
+ .build());
return aaiObjectAudit;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 1fa757f547..c1a97cefc4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -50,9 +50,9 @@ import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.Vserver;
-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.heatbridge.constants.HeatBridgeConstants;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.network.Network;
@@ -82,39 +82,39 @@ public class AaiHelper {
// vserver to pserver relationship
if (!StringUtils.isEmpty(server.getHypervisorHostname())) {
- Relationship pserverRelationship = buildRelationship(
- AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, server.getHypervisorHostname()));
+ Relationship pserverRelationship = buildRelationship(AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().pserver(server.getHypervisorHostname())));
relationships.add(pserverRelationship);
}
// vserver to generic-vnf relationship
- Relationship genericVnfRelationship =
- buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId));
+ Relationship genericVnfRelationship = buildRelationship(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId)));
relationships.add(genericVnfRelationship);
// vserver to vnfc relationship
if (!StringUtils.isEmpty(server.getName())) {
- Relationship vnfcRelationship =
- buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VNFC, server.getName()));
+ Relationship vnfcRelationship = buildRelationship(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(server.getName())));
relationships.add(vnfcRelationship);
}
// vserver to vf-module relationship
- Relationship vfModuleRelationship =
- buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, genericVnfId, vfModuleId));
+ Relationship vfModuleRelationship = buildRelationship(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId)));
relationships.add(vfModuleRelationship);
// vserver to image relationship
if (server.getImage() != null) {
- Relationship imageRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.IMAGE, cloudOwner,
- cloudRegionId, server.getImage().getId()));
+ Relationship imageRel = buildRelationship(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).image(server.getImage().getId())));
relationships.add(imageRel);
}
// vserver to flavor relationship
if (server.getFlavor() != null) {
- Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner,
- cloudRegionId, server.getFlavor().getId()));
+ Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).flavor(server.getFlavor().getId())));
relationships.add(flavorRel);
}
@@ -127,20 +127,21 @@ public class AaiHelper {
List<Relationship> relationships = relationshipList.getRelationship();
// sriov-vf to sriov-pf relationship
- Relationship sriovPfRelationship = buildRelationship(
- AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF, pserverName, pIfName, pfPciId));
+ Relationship sriovPfRelationship = buildRelationship(AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName).pInterface(pIfName).sriovPf(pfPciId)));
relationships.add(sriovPfRelationship);
return relationshipList;
}
public Relationship getRelationshipToVfModule(String vnfId, String vfModuleId) {
- return buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId));
+ return buildRelationship(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)));
}
public Relationship getRelationshipToTenant(String cloudOwner, String cloudRegionId, String tenantId) {
- return buildRelationship(
- AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegionId, tenantId));
+ return buildRelationship(AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId)));
}
public org.onap.aai.domain.yang.Subnet buildSubnet(Subnet subnet) {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
index 76bc8d2456..9d5a4c62b9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -17,10 +17,10 @@ import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
-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.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
@@ -94,7 +94,8 @@ public class CloudRegionRestImplTest {
public void createCloudRegionTest() {
when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
+ AAIResourceUri uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("bob", "region1"));
cloudRestImpl.createCloudRegion(cloudSite);
ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index e70b56dfc5..2e496c50cd 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -41,12 +41,12 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
-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.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -70,35 +70,43 @@ public class AuditVServerTest extends AuditVServer {
private String cloudRegion = "cloudRegion";
private String tenantId = "tenantId";
- private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
- tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db");
+ private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"));
- private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
- tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
+ private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"));
- private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_trusted_port_0");
+ private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_trusted_port_0"));
- private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0");
+ private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service1_port_0"));
- private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_1");
+ private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_1"));
- private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_0");
+ private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_0"));
- private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0");
+ private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service2_port_0"));
- private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_int_ha_port_0");
+ private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_int_ha_port_0"));
- private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_1");
+ private AAIResourceUri test_port_1_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_1"));
- private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_2");
+ private AAIResourceUri test_port_2_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_2"));
private AAIResourceUri service2_sub_1_uri =
AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
@@ -368,17 +376,20 @@ public class AuditVServerTest extends AuditVServer {
Vserver vserver = new Vserver();
vserver.setVserverId("testVserverId");
obj1.setAaiObject(vserver);
- obj1.setResourceURI(AAIUriFactory
- .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build());
+ obj1.setResourceURI(
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId"))
+ .build());
auditList.getAuditList().add(obj1);
- doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
- cloudRegion, tenantId, "testVserverId"));
+ doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
auditNova.auditVservers(auditList);
- Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
- cloudRegion, tenantId, "testVserverId"));
+ Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
}
@@ -392,8 +403,8 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
- "vfModuleName"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+ .queryParam("vf-module-name", "vfModuleName"));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -410,11 +421,12 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
- "vfModuleName"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+ .queryParam("vf-module-name", "vfModuleName"));
- doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
- "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
+ doReturn(vserverWrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion("cloud-owner", "cloud-region-id").tenant("tenant-id").vserver("VUSCHGA1")));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index cea436b799..110faaf8ab 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -45,7 +45,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.doReturn;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -66,20 +65,17 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.SriovPf;
import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
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.GraphInventoryCommonObjectMapperProvider;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.cloud.resource.beans.NodeType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -105,7 +101,6 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
-import inet.ipaddr.IPAddressString;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -202,10 +197,10 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server1.getId()), uris.get(0));
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server2.getId()), uris.get(1));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
}
@@ -246,10 +241,10 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server1.getId()), uris.get(0));
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server2.getId()), uris.get(1));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
}
@Test