aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-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
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java4
7 files changed, 60 insertions, 5 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());
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
index d7b3b03333..26904fa8a4 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
@@ -35,6 +35,7 @@ import org.mockito.stubbing.Answer;
import org.onap.so.adapters.nssmf.consts.NssmfAdapterConsts;
import org.onap.so.adapters.nssmf.entity.NssmfInfo;
import org.onap.so.adapters.nssmf.entity.TokenResponse;
+import org.onap.so.adapters.nssmf.enums.ActionType;
import org.onap.so.adapters.nssmf.enums.HttpMethod;
import org.onap.so.adapters.nssmf.util.RestUtil;
import org.onap.so.beans.nsmf.*;
@@ -358,6 +359,7 @@ public class NssmfManagerServiceImplTest {
operationStatus.setOperationId("4b45d919816ccaa2b762df5120f72067");
operationStatus.setResourceTemplateUUID("8ee5926d-720b-4bb2-86f9-d20e921c143b");
operationStatus.setServiceId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ operationStatus.setOperType(ActionType.ALLOCATE.toString());
NssmfAdapterNBIRequest nbiRequest = createNbiRequest();
nbiRequest.setResponseId("7512eb3feb5249eca5ddd742fedddd39");
@@ -376,8 +378,6 @@ public class NssmfManagerServiceImplTest {
assertEquals(allRes.getResponseDescriptor().getStatus(), "processing");
assertEquals(allRes.getResponseDescriptor().getResponseId(), "7512eb3feb5249eca5ddd742fedddd39");
- System.out.println(res);
-
}
@Test