summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java8
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java37
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java1
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java5
5 files changed, 37 insertions, 16 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 dacab3b168..77662bf272 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
@@ -34,4 +34,6 @@ public interface AaiServiceProvider {
String serviceInstanceId);
ServiceInstance invokeGetServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId);
+
+ void invokeDeleteServiceInstance(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 7cdeac4507..1d7c42aafe 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
@@ -87,4 +87,12 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
return null;
});
}
+
+ @Override
+ public void invokeDeleteServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
+
+ aaiClientProvider.getAaiClient().delete(uri);
+ }
}
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 7a5b6a4926..bb2b83fd59 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
@@ -25,6 +25,7 @@ import org.apache.http.message.BasicHeader;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.so.adapters.nssmf.entity.NssmfInfo;
import org.onap.so.adapters.nssmf.entity.RestResponse;
+import org.onap.so.adapters.nssmf.enums.ActionType;
import org.onap.so.adapters.nssmf.enums.JobStatus;
import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
import org.onap.so.adapters.nssmf.util.NssmfAdapterUtil;
@@ -63,28 +64,32 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
protected void afterQueryJobStatus(ResourceOperationStatus status) {
if (Integer.parseInt(status.getProgress()) == 100) {
- ServiceInstance nssiInstance = restUtil.getServiceInstance(serviceInfo);
- if (nssiInstance == null) {
- nssiInstance = new ServiceInstance();
- }
+ ActionType jobOperType = ActionType.valueOf(status.getOperType());
+
+ if (ActionType.ALLOCATE.equals(jobOperType)) {
+ ServiceInstance nssiInstance = restUtil.getServiceInstance(serviceInfo);
+ if (nssiInstance == null) {
+ nssiInstance = new ServiceInstance();
+ }
- nssiInstance.setServiceInstanceId(serviceInfo.getNssiId());
- nssiInstance.setServiceInstanceName(serviceInfo.getNssiName());
- nssiInstance.setServiceType(serviceInfo.getSST());
+ nssiInstance.setServiceInstanceId(serviceInfo.getNssiId());
+ nssiInstance.setServiceInstanceName(serviceInfo.getNssiName());
+ nssiInstance.setServiceType(serviceInfo.getSST());
- nssiInstance.setOrchestrationStatus(initStatus);
- nssiInstance.setModelInvariantId(serviceInfo.getServiceInvariantUuid());
- nssiInstance.setModelVersionId(serviceInfo.getServiceUuid());
- nssiInstance.setServiceInstanceLocationId(serviceInfo.getPLMNIdList());
- nssiInstance.setEnvironmentContext(esrInfo.getNetworkType().getNetworkType());
- nssiInstance.setServiceRole("nssi");
+ nssiInstance.setOrchestrationStatus(initStatus);
+ nssiInstance.setModelInvariantId(serviceInfo.getServiceInvariantUuid());
+ nssiInstance.setModelVersionId(serviceInfo.getServiceUuid());
+ nssiInstance.setServiceInstanceLocationId(serviceInfo.getPLMNIdList());
+ nssiInstance.setEnvironmentContext(esrInfo.getNetworkType().getNetworkType());
+ nssiInstance.setServiceRole("nssi");
- restUtil.createServiceInstance(nssiInstance, serviceInfo);
+ restUtil.createServiceInstance(nssiInstance, serviceInfo);
+ } else if (ActionType.DEALLOCATE.equals(jobOperType)) {
+ restUtil.deleteServiceInstance(serviceInfo);
+ }
}
}
-
-
@Override
protected String wrapActDeActReqBody(ActDeActNssi actDeActNssi) throws ApplicationException {
return marshal(actDeActNssi);
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 eb2dba0f44..c51b72d61e 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
@@ -76,6 +76,7 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
ResourceOperationStatus status =
new ResourceOperationStatus(serviceInfo.getNsiId(), resp.getJobId(), serviceInfo.getServiceUuid());
status.setResourceInstanceID(nssiId);
+ status.setOperType(actionType.toString());
updateDbStatus(status, restResponse.getStatus(), JobStatus.FINISHED,
NssmfAdapterUtil.getStatusDesc(actionType));
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 432cfacb0b..a7adbe116a 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
@@ -82,6 +82,11 @@ public class RestUtil {
serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());
}
+ public void deleteServiceInstance(ServiceInfo serviceInfo) {
+ aaiSvcProv.invokeDeleteServiceInstance(serviceInfo.getGlobalSubscriberId(),
+ serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());
+ }
+
public NssmfInfo getNssmfHost(EsrInfo esrInfo) throws ApplicationException {
EsrThirdpartySdncList sdncList = aaiSvcProv.invokeGetThirdPartySdncList();
if (sdncList != null && sdncList.getEsrThirdpartySdnc() != null) {