summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuanyu Chen <chenchuanyu@huawei.com>2020-10-28 01:44:30 +0000
committerGerrit Code Review <gerrit@onap.org>2020-10-28 01:44:30 +0000
commit4b819e2b9771fb9e903cdf523c84be6007c9a4e8 (patch)
tree3f921aa7e45d49ac1dc6fc08a7f5ff629b257afc
parentdeb4f1d1292d661b08f8969a117b7b979551158a (diff)
parentaa859daa7e210a286aae0e496fa09b4d9c133b86 (diff)
Merge "Fix issue of writing NSSI to AAI for ExternalNssmfManager"
-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
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy1
6 files changed, 26 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) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 75ef7d347c..f3bc47e7cf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -151,6 +151,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
serviceInfo.setServiceUuid(serviceUuid)
serviceInfo.setNsiId(nsiId)
+ serviceInfo.setNssiId(nssiId)
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
String serviceInfoString = objectMapper.writeValueAsString(serviceInfo)