summaryrefslogtreecommitdiffstats
path: root/adapters/mso-nssmf-adapter/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-nssmf-adapter/src/main/java/org')
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java3
-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/external/ExternalAnNssmfManager.java23
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalCnNssmfManager.java20
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java5
6 files changed, 58 insertions, 3 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
index 8f029e7075..a24f8ef0c7 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
@@ -131,7 +131,7 @@ public class NssmfAdapterConsts {
urlInfoMap.put(generateKey(ExecutorType.EXTERNAL, NetworkType.CORE, ActionType.DEACTIVATE),
new NssmfUrlInfo(EXTERNAL_CN_DEACTIVATE_URL, HttpMethod.PUT));
urlInfoMap.put(generateKey(ExecutorType.INTERNAL, null, ActionType.DEACTIVATE),
- new NssmfUrlInfo(INTERNAL_DEACTIVATE_URL, HttpMethod.PUT));
+ new NssmfUrlInfo(INTERNAL_DEACTIVATE_URL, HttpMethod.POST));
urlInfoMap.put(generateKey(ExecutorType.EXTERNAL, NetworkType.ACCESS, ActionType.TERMINATE),
new NssmfUrlInfo(EXTERNAL_AN_TERMINATE_URL, HttpMethod.DELETE));
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 77662bf272..4df2fa16e1 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,6 +33,9 @@ public interface AaiServiceProvider {
void invokeCreateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
String serviceInstanceId);
+ void invokeUpdateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
+ 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 1d7c42aafe..688012efe7 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
@@ -77,6 +77,14 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
+ public void invokeUpdateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
+ String serviceInstanceId) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
+ aaiClientProvider.getAaiClient().update(uri, nssiInstance);
+ }
+
+ @Override
public ServiceInstance invokeGetServiceInstance(String globalSubscriberId, String serviceType,
String serviceInstanceId) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
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 20ad3d10b7..1af6d15c06 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
@@ -43,7 +43,10 @@ import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
public class ExternalAnNssmfManager extends ExternalNssmfManager {
- private Map<String, String> bodyParams = new HashMap<>(); // request body params
+ /**
+ * request body params
+ */
+ private Map<String, String> bodyParams = new HashMap<>();
@Override
protected String doWrapExtAllocateReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException {
@@ -125,7 +128,23 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
@Override
public RestResponse activateNssi(NssmfAdapterNBIRequest nbiRequest, String snssai) throws ApplicationException {
// TODO
- return null;
+ NssiResponse resp = new NssiResponse();
+ String nssiId = nbiRequest.getActDeActNssi().getNssiId();
+ resp.setJobId(UUID.randomUUID().toString());
+ resp.setNssiId(nssiId);
+
+ RestResponse returnRsp = new RestResponse();
+
+ returnRsp.setStatus(202);
+ returnRsp.setResponseContent(marshal(resp));
+
+ ResourceOperationStatus status =
+ new ResourceOperationStatus(serviceInfo.getNsiId(), resp.getJobId(), serviceInfo.getServiceUuid());
+ status.setResourceInstanceID(nssiId);
+ status.setOperType(actionType.toString());
+
+ updateDbStatus(status, returnRsp.getStatus(), JobStatus.FINISHED, NssmfAdapterUtil.getStatusDesc(actionType));
+ return returnRsp;
}
@Override
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalCnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalCnNssmfManager.java
index fb76adcce6..08c464e46b 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalCnNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalCnNssmfManager.java
@@ -20,11 +20,14 @@
package org.onap.so.adapters.nssmf.manager.impl.external;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.so.adapters.nssmf.enums.ActionType;
import org.onap.so.adapters.nssmf.enums.SelectionType;
import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
import org.onap.so.adapters.nssmf.manager.impl.ExternalNssmfManager;
import org.onap.so.beans.nsmf.DeAllocateNssi;
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
public class ExternalCnNssmfManager extends ExternalNssmfManager {
@@ -45,6 +48,23 @@ public class ExternalCnNssmfManager extends ExternalNssmfManager {
}
@Override
+ protected void afterQueryJobStatus(ResourceOperationStatus status) {
+ super.afterQueryJobStatus(status);
+ ActionType jobOperType = ActionType.valueOf(status.getOperType());
+ if (Integer.parseInt(status.getProgress()) == 100) {
+ if (ActionType.ACTIVATE.equals(jobOperType)) {
+ ServiceInstance nssiInstance = restUtil.getServiceInstance(serviceInfo);
+ nssiInstance.setOrchestrationStatus("activated");
+ restUtil.updateServiceInstance(nssiInstance, serviceInfo);
+ } else if (ActionType.DEACTIVATE.equals(jobOperType)) {
+ ServiceInstance nssiInstance = restUtil.getServiceInstance(serviceInfo);
+ nssiInstance.setOrchestrationStatus("deactivated");
+ restUtil.updateServiceInstance(nssiInstance, serviceInfo);
+ }
+ }
+ }
+
+ @Override
protected SelectionType doQueryNSSISelectionCapability() {
return SelectionType.NSMF;
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 7a86c5ba2b..60bf423ed8 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 void updateServiceInstance(ServiceInstance serviceInstance, ServiceInfo serviceInfo) {
+ aaiSvcProv.invokeUpdateServiceInstance(serviceInstance, serviceInfo.getGlobalSubscriberId(),
+ serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());
+ }
+
public ServiceInstance getServiceInstance(ServiceInfo serviceInfo) {
return aaiSvcProv.invokeGetServiceInstance(serviceInfo.getGlobalSubscriberId(),
serviceInfo.getSubscriptionServiceType(), serviceInfo.getNssiId());