aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-nssmf-adapter/src
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-nssmf-adapter/src')
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java20
1 files changed, 15 insertions, 5 deletions
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 ef979a660f..bc7a3d0bb7 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
@@ -33,12 +33,15 @@ import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
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
+
@Override
protected String doWrapExtAllocateReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException {
Map<String, Object> request = new HashMap<>();
@@ -49,13 +52,17 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
@Override
protected void doAfterRequest() throws ApplicationException {
if (ActionType.ALLOCATE.equals(actionType) || ActionType.DEALLOCATE.equals(actionType)) {
- @SuppressWarnings("unchecked")
- Map<String, String> response = unMarshal(restResponse.getResponseContent(), Map.class);
-
- String nssiId = response.get("nSSId");
+ String nssiId;
+ if (ActionType.ALLOCATE.equals(actionType)) {
+ @SuppressWarnings("unchecked")
+ Map<String, String> response = unMarshal(restResponse.getResponseContent(), Map.class);
+ nssiId = response.get("href");
+ } else {
+ nssiId = this.bodyParams.get("nssiId");
+ }
NssiResponse resp = new NssiResponse();
- resp.setJobId(nssiId);
+ resp.setJobId(UUID.randomUUID().toString());
resp.setNssiId(nssiId);
RestResponse returnRsp = new RestResponse();
@@ -82,6 +89,9 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
@Override
protected String doWrapDeAllocateReqBody(DeAllocateNssi deAllocateNssi) throws ApplicationException {
+ this.bodyParams.clear();
+ this.bodyParams.put("nssiId", deAllocateNssi.getNssiId());
+
Map<String, String> request = new HashMap<>();
request.put("nSSId", deAllocateNssi.getNssiId());
return marshal(request);