diff options
8 files changed, 43 insertions, 21 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) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy index 1964a189f1..b457bdca46 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy @@ -83,7 +83,7 @@ class DoHandleOofRequest extends AbstractServiceTaskProcessor { execution.setVariable("oofRequestPayload", requestJson) } - public void callOofAdapter(DelegateExecution execution) { + void callOofAdapter(DelegateExecution execution) { logger.debug("Start callOofAdapter") String requestId = execution.getVariable("msoRequestId") String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 30cbeaf2d8..ff31c46a3a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -540,10 +540,8 @@ class OofUtils { " \"timeout\": 600,\n" + " \"callbackUrl\": \"${callbackUrl}\"\n" + " },\n") - response.append(" \"serviceProfile\": {\n" + - " \"serviceProfileParameters\": ") - response.append(json); - response.append("\n }\n") + response.append(" \"serviceProfile\":") + response.append(json) response.append("\n}\n") return response.toString() } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 1d5232f3c5..cfdbe98c34 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -371,6 +371,9 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ execution.setVariable("needQuerySliceProfile", true) } else { + if(execution.getVariable("needQuerySliceProfile")){ + execution.setVariable("needQuerySliceProfile", false) + } processNewNSI(solution, sliceTaskParams) } } |