Update parameter processing of NSSMF adapter for External RAN NSSMF 51/112151/3
authorEnbo Wang <wangenbo@huawei.com>
Fri, 4 Sep 2020 08:32:49 +0000 (16:32 +0800)
committerEnbo Wang <wangenbo@huawei.com>
Fri, 4 Sep 2020 10:08:13 +0000 (18:08 +0800)
Issue-ID: SO-3202
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Change-Id: I65dfb46e1af981ec49a5a8c36c8fc5ea9b3bda9c

adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java

index ef979a6..bc7a3d0 100644 (file)
@@ -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);
index 26c3c00..83675da 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.so.beans.nsmf;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 import java.util.List;
 
@@ -28,24 +29,33 @@ import java.util.List;
 @Data
 public class AnSliceProfile {
 
-    private List<String> sNSSAIList;
-
+    @JsonProperty(value = "sliceProfileId", required = true)
     private String sliceProfileId;
 
-    private List<Integer> coverageAreaTAList;
-
-    @JsonInclude(JsonInclude.Include.NON_DEFAULT)
-    private int latency;
+    @JsonProperty(value = "sNSSAIList", required = true)
+    private List<String> sNSSAIList;
 
+    @JsonProperty(value = "pLMNIdList", required = true)
     private List<String> pLMNIdList;
 
+    @JsonProperty(value = "perfReq", required = true)
     private AnPerfReq perfReq;
 
     @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+    @JsonProperty(value = "maxNumberofUEs")
     private long maxNumberofUEs;
 
+    @JsonProperty(value = "coverageAreaTAList")
+    private List<Integer> coverageAreaTAList;
+
+    @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+    @JsonProperty(value = "latency")
+    private int latency;
+
+    @JsonProperty(value = "uEMobilityLevel")
     private UeMobilityLevel uEMobilityLevel;
 
+    @JsonProperty(value = "resourceSharingLevel")
     private ResourceSharingLevel resourceSharingLevel;
 
 }