aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-nssmf-adapter
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2020-10-26 21:34:42 +0800
committerEnbo Wang <wangenbo@huawei.com>2020-10-26 21:34:42 +0800
commitaa859daa7e210a286aae0e496fa09b4d9c133b86 (patch)
treef41527ce270702b7069c240ec613e2deff67efb4 /adapters/mso-nssmf-adapter
parent2510a11d6404db223e8b185797ab67c6da3d721d (diff)
Fix issue of writing NSSI to AAI for ExternalNssmfManager
Issue-ID: SO-3341 Signed-off-by: Enbo Wang <wangenbo@huawei.com> Change-Id: I242b48bee5420bc2a346240baa6056e31acb006c
Diffstat (limited to 'adapters/mso-nssmf-adapter')
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java1
-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/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java6
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java5
5 files changed, 25 insertions, 1 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
index 665b111e03..dacab3b168 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
@@ -33,4 +33,5 @@ public interface AaiServiceProvider {
void invokeCreateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
String serviceInstanceId);
+ ServiceInstance invokeGetServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId);
}
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 b972517338..7cdeac4507 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
@@ -75,4 +75,16 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
.customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
aaiClientProvider.getAaiClient().create(uri, nssiInstance);
}
+
+ @Override
+ public ServiceInstance invokeGetServiceInstance(String globalSubscriberId, String serviceType,
+ String serviceInstanceId) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
+
+ return aaiClientProvider.getAaiClient().get(ServiceInstance.class, uri).orElseGet(() -> {
+ logger.debug("ServiceInstance " + serviceInstanceId + " not found in AAI");
+ return null;
+ });
+ }
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index fc23ca9feb..7a5b6a4926 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -63,7 +63,11 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
protected void afterQueryJobStatus(ResourceOperationStatus status) {
if (Integer.parseInt(status.getProgress()) == 100) {
- ServiceInstance nssiInstance = new ServiceInstance();
+ ServiceInstance nssiInstance = restUtil.getServiceInstance(serviceInfo);
+ if (nssiInstance == null) {
+ nssiInstance = new ServiceInstance();
+ }
+
nssiInstance.setServiceInstanceId(serviceInfo.getNssiId());
nssiInstance.setServiceInstanceName(serviceInfo.getNssiName());
nssiInstance.setServiceType(serviceInfo.getSST());
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
index 491da0aab4..eb2dba0f44 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
@@ -128,6 +128,8 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
updateRequestDbJobStatus(responseDescriptor, status, restResponse);
+ status.setProgress(Integer.toString(responseDescriptor.getProgress()));
+
return restResponse;
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
index 0c5999b20e..a4a79bf2cd 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
@@ -77,6 +77,11 @@ public class RestUtil {
serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());
}
+ public ServiceInstance getServiceInstance(ServiceInfo serviceInfo) {
+ return aaiSvcProv.invokeGetServiceInstance(serviceInfo.getGlobalSubscriberId(),
+ serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());
+ }
+
public NssmfInfo getNssmfHost(EsrInfo esrInfo) throws ApplicationException {
EsrThirdpartySdncList sdncList = aaiSvcProv.invokeGetThirdPartySdncList();
if (sdncList != null && sdncList.getEsrThirdpartySdnc() != null) {