diff options
Diffstat (limited to 'so-etsi-nfvo')
-rw-r--r-- | so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java index 049746c6ab..c48d10bb69 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java @@ -22,9 +22,10 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai; import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; 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.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,8 +48,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { public void createServiceInstance(final String globalCustomerId, final String serviceType, final ServiceInstance aaiServiceInstance) { logger.info("Creating service instance in AAI: {}", aaiServiceInstance); - final AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustomerId, serviceType, aaiServiceInstance.getServiceInstanceId()); + final AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId) + .serviceSubscription(serviceType).serviceInstance(aaiServiceInstance.getServiceInstanceId())); aaiClientProvider.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance)); } @@ -57,9 +59,10 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { public void createGenericVnfAndConnectServiceInstance(final String serviceInstanceId, final String vnfId, final GenericVnf genericVnf) { logger.info("Creating GenericVnf in AAI: {}", genericVnf); - final AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + final AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); final AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); aaiClientProvider.getAaiClient().createIfNotExists(genericVnfURI, Optional.of(genericVnf)) .connect(genericVnfURI, serviceInstanceURI); @@ -69,15 +72,16 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { public void connectGenericVnfToTenant(final String vnfId, final String cloudOwner, final String cloudRegion, final String tenantId) { logger.info("Connecting GenericVnf {} to {}/{}/{} in AAI", vnfId, cloudOwner, cloudRegion, tenantId); - final AAIResourceUri tenantURI = - AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId); - final AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + final AAIResourceUri tenantURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)); + final AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); aaiClientProvider.getAaiClient().connect(tenantURI, genericVnfURI); } @Override public Optional<GenericVnf> getGenericVnf(final String vnfId) { return aaiClientProvider.getAaiClient().get(GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))); } } |