diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java | 5 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java | 90 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java | 2 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java | 5 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java | 3 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java (renamed from common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java) | 35 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java | 116 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java | 74 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java | 14 |
9 files changed, 212 insertions, 132 deletions
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java index eef0396205..14918c7873 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java @@ -31,6 +31,9 @@ import java.util.List; @Data @ToString public class AnSliceProfile implements Serializable { + /* + * Reference 3GPP TS 28.541 V16.5.0, Section 6.3.4. + */ private static final long serialVersionUID = -3057342171549542794L; @@ -44,7 +47,7 @@ public class AnSliceProfile implements Serializable { private List<String> pLMNIdList; @JsonProperty(value = "perfReq", required = true) - private AnPerfReq perfReq; + private PerfReq perfReq; @JsonInclude(JsonInclude.Include.NON_DEFAULT) @JsonProperty(value = "maxNumberofUEs") diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java index 3bd155d512..1fa84eee59 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java @@ -21,100 +21,40 @@ package org.onap.so.beans.nsmf; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import java.io.Serializable; import java.util.List; @JsonInclude(JsonInclude.Include.NON_NULL) -public class CnSliceProfile { +@Data +public class CnSliceProfile implements Serializable { + private static final long serialVersionUID = 6627071735572539536L; + + @JsonProperty(value = "sNSSAIList", required = true) private List<String> snssaiList; private String sliceProfileId; + @JsonProperty(value = "pLMNIdList", required = true) private List<String> plmnIdList; + @JsonProperty(value = "perfReq", required = true) private PerfReq perfReq; - @JsonInclude(JsonInclude.Include.NON_DEFAULT) + @JsonProperty(value = "maxNumberofUEs") private int maxNumberofUEs; + @JsonProperty(value = "coverageAreaTAList") private List<String> coverageAreaTAList; - @JsonInclude(JsonInclude.Include.NON_DEFAULT) + @JsonProperty(value = "latency") private int latency; + @JsonProperty(value = "uEMobilityLevel") private UeMobilityLevel ueMobilityLevel; + @JsonProperty(value = "resourceSharingLevel") private ResourceSharingLevel resourceSharingLevel; - - public String getSliceProfileId() { - return sliceProfileId; - } - - public void setSliceProfileId(String sliceProfileId) { - this.sliceProfileId = sliceProfileId; - } - - public List<String> getPlmnIdList() { - return plmnIdList; - } - - public void setPlmnIdList(List<String> plmnIdList) { - this.plmnIdList = plmnIdList; - } - - public PerfReq getPerfReq() { - return perfReq; - } - - public void setPerfReq(PerfReq perfReq) { - this.perfReq = perfReq; - } - - public int getMaxNumberofUEs() { - return maxNumberofUEs; - } - - public void setMaxNumberofUEs(int maxNumberofUEs) { - this.maxNumberofUEs = maxNumberofUEs; - } - - public List<String> getCoverageAreaTAList() { - return coverageAreaTAList; - } - - public void setCoverageAreaTAList(List<String> coverageAreaTAList) { - this.coverageAreaTAList = coverageAreaTAList; - } - - public int getLatency() { - return latency; - } - - public void setLatency(int latency) { - this.latency = latency; - } - - public UeMobilityLevel getUeMobilityLevel() { - return ueMobilityLevel; - } - - public void setUeMobilityLevel(UeMobilityLevel ueMobilityLevel) { - this.ueMobilityLevel = ueMobilityLevel; - } - - public ResourceSharingLevel getResourceSharingLevel() { - return resourceSharingLevel; - } - - public void setResourceSharingLevel(ResourceSharingLevel resourceSharingLevel) { - this.resourceSharingLevel = resourceSharingLevel; - } - - public List<String> getSnssaiList() { - return snssaiList; - } - - public void setSnssaiList(List<String> snssaiList) { - this.snssaiList = snssaiList; - } } diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java index e4989059a3..8dd369181a 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java @@ -44,7 +44,7 @@ public class NssmfAdapterNBIRequest implements Serializable { private DeAllocateNssi deAllocateNssi; - private Object subnetCapabilityQuery; + private QuerySubnetCapability subnetCapabilityQuery; private String responseId; } diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java index c67f193a02..6697c8d8a0 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java @@ -21,10 +21,13 @@ package org.onap.so.beans.nsmf; import com.fasterxml.jackson.annotation.JsonInclude; +import java.io.Serializable; import java.util.List; @JsonInclude(JsonInclude.Include.NON_NULL) -public class PerfReq { +public class PerfReq implements Serializable { + + private static final long serialVersionUID = 8463835350563510267L; private List<PerfReqEmbb> perfReqEmbbList; diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java index f6e945e368..1db009cdb9 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java @@ -25,6 +25,9 @@ import java.io.Serializable; @JsonInclude(JsonInclude.Include.NON_NULL) public class PerfReqEmbb implements Serializable { + /* + * Reference 3GPP TS 28.541 V16.5.0, Section 6.4.1. + */ private static final long serialVersionUID = 8886635511695277599L; diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java index e2c2e999ec..7485b387d8 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2020 Wipro Limited. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,31 +20,30 @@ package org.onap.so.beans.nsmf; + import com.fasterxml.jackson.annotation.JsonInclude; -import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +/** + * Model class for slice subnet capability query + */ @JsonInclude(JsonInclude.Include.NON_NULL) -public class AnPerfReq implements Serializable { - - private static final long serialVersionUID = -7415880702887244040L; +public class QuerySubnetCapability { - private PerfReqEmbb perfReqEmbb; - - private PerfReqUrllc perfReqUrllc; - - public PerfReqEmbb getPerfReqEmbb() { - return perfReqEmbb; - } + @JsonProperty("subnetTypes") + private List<String> subnetTypes; - public void setPerfReqEmbb(PerfReqEmbb perfReqEmbb) { - this.perfReqEmbb = perfReqEmbb; + public List<String> getSubnetTypes() { + return subnetTypes; } - public PerfReqUrllc getPerfReqUrllc() { - return perfReqUrllc; + public void setSubnetTypes(List<String> subnetTypes) { + this.subnetTypes = subnetTypes; } - public void setPerfReqUrllc(PerfReqUrllc perfReqUrllc) { - this.perfReqUrllc = perfReqUrllc; + @Override + public String toString() { + return "QuerySubnetCapability [subnetType=" + subnetTypes + "]"; } } diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java new file mode 100644 index 0000000000..9b6df0fa9e --- /dev/null +++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.beans.nsmf; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.ToString; +import org.springframework.beans.BeanUtils; +import java.io.Serializable; +import java.util.Arrays; + +@Data +@ToString +public class SliceProfileAdapter implements Serializable { + + private static final long serialVersionUID = -6412175980642584804L; + + @JsonProperty(value = "sliceProfileId") + private String sliceProfileId; + + @JsonProperty(value = "sNSSAI") + private String sNSSAIList = ""; + + @JsonProperty(value = "pLMNIdList") + private String pLMNIdList = ""; + + @JsonProperty(value = "maxNumberofUEs") + private long maxNumberofUEs; + + @JsonProperty(value = "coverageAreaTAList") + private String coverageAreaTAList = ""; + + @JsonProperty(value = "latency") + private int latency; + + @JsonProperty(value = "uEMobilityLevel") + private String uEMobilityLevel; + + @JsonProperty(value = "resourceSharingLevel") + private String resourceSharingLevel; + + @JsonProperty(value = "maxBandwidth") + private String bandwidth; + + @JsonProperty(value = "sST") + private String sST; + + @JsonProperty(value = "activityFactor") + private String activityFactor; + + @JsonProperty(value = "survivalTime") + private String survivalTime; + + public AnSliceProfile trans2AnProfile() { + AnSliceProfile anSliceProfile = new AnSliceProfile(); + BeanUtils.copyProperties(this, anSliceProfile); + anSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|"))); + anSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|"))); + + String[] areas = this.coverageAreaTAList.split("\\|"); + Integer[] areasRes = new Integer[areas.length]; + for (int i = 0; i < areas.length; i++) { + areasRes[i] = str2Code(areas[i]); + } + anSliceProfile.setCoverageAreaTAList(Arrays.asList(areasRes)); + anSliceProfile.setUEMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel)); + anSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel)); + PerfReq perfReq = new PerfReq(); + // todo + anSliceProfile.setPerfReq(perfReq); + return anSliceProfile; + } + + private Integer str2Code(String area) { + return area.hashCode() >> 16; + } + + public CnSliceProfile trans2CnProfile() { + CnSliceProfile cnSliceProfile = new CnSliceProfile(); + BeanUtils.copyProperties(this, cnSliceProfile); + cnSliceProfile.setSnssaiList(Arrays.asList(this.sNSSAIList.split("\\|"))); + cnSliceProfile.setCoverageAreaTAList(Arrays.asList(this.coverageAreaTAList.split("\\|"))); + cnSliceProfile.setPlmnIdList(Arrays.asList(this.pLMNIdList.split("\\|"))); + cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel)); + PerfReq perfReq = new PerfReq(); + // todo + cnSliceProfile.setPerfReq(perfReq); + return cnSliceProfile; + } + + public TnSliceProfile trans2TnProfile() { + TnSliceProfile tnSliceProfile = new TnSliceProfile(); + BeanUtils.copyProperties(this, tnSliceProfile); + tnSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|"))); + tnSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|"))); + return tnSliceProfile; + } +} diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java index e97aa704eb..bfd4627b47 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java @@ -19,6 +19,7 @@ */ package org.onap.so.beans.nsmf; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.JsonObject; import lombok.*; @@ -56,15 +57,15 @@ public class SliceTaskParamsAdapter implements Serializable { private TemplateInfo NSTInfo = new TemplateInfo(); - private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo = new SliceTaskInfo<>(); + private SliceTaskInfo<SliceProfileAdapter> tnBHSliceTaskInfo = new SliceTaskInfo<>(); - private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo = new SliceTaskInfo<>(); + private SliceTaskInfo<SliceProfileAdapter> tnMHSliceTaskInfo = new SliceTaskInfo<>(); - private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo = new SliceTaskInfo<>(); + private SliceTaskInfo<SliceProfileAdapter> tnFHSliceTaskInfo = new SliceTaskInfo<>(); - private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo = new SliceTaskInfo<>(); + private SliceTaskInfo<SliceProfileAdapter> cnSliceTaskInfo = new SliceTaskInfo<>(); - private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo = new SliceTaskInfo<>(); + private SliceTaskInfo<SliceProfileAdapter> anSliceTaskInfo = new SliceTaskInfo<>(); @SuppressWarnings("unchecked") public void convertFromJson(String jsonString) throws IOException { @@ -80,24 +81,24 @@ public class SliceTaskParamsAdapter implements Serializable { this.setServiceProfile(replaceHeader(paramMap, "ServiceProfile.")); - TnSliceProfile tnBHSliceProfile = mapper.readValue( - mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.BH.")), TnSliceProfile.class); + SliceProfileAdapter tnBHSliceProfile = mapper.readValue( + mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.BH.")), SliceProfileAdapter.class); this.tnBHSliceTaskInfo.setSliceProfile(tnBHSliceProfile); - TnSliceProfile tnMHSliceProfile = mapper.readValue( - mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.MH.")), TnSliceProfile.class); + SliceProfileAdapter tnMHSliceProfile = mapper.readValue( + mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.MH.")), SliceProfileAdapter.class); this.tnMHSliceTaskInfo.setSliceProfile(tnMHSliceProfile); - TnSliceProfile tnFHSliceProfile = mapper.readValue( - mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.FH.")), TnSliceProfile.class); + SliceProfileAdapter tnFHSliceProfile = mapper.readValue( + mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.FH.")), SliceProfileAdapter.class); this.tnFHSliceTaskInfo.setSliceProfile(tnFHSliceProfile); - CnSliceProfile cnSliceProfile = mapper.readValue( - mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.CN.")), CnSliceProfile.class); + SliceProfileAdapter cnSliceProfile = mapper.readValue( + mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.CN.")), SliceProfileAdapter.class); this.cnSliceTaskInfo.setSliceProfile(cnSliceProfile); - AnSliceProfile anSliceProfile = mapper.readValue( - mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.AN.")), AnSliceProfile.class); + SliceProfileAdapter anSliceProfile = mapper.readValue( + mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.AN.")), SliceProfileAdapter.class); this.anSliceTaskInfo.setSliceProfile(anSliceProfile); this.tnBHSliceTaskInfo.setSuggestNssiId(paramMap.get("TN.BH.SuggestNSSIId")); @@ -148,33 +149,31 @@ public class SliceTaskParamsAdapter implements Serializable { for (Map.Entry<String, Object> entry : serviceProfile.entrySet()) { jsonObject.addProperty("ServiceProfile." + entry.getKey(), entry.getValue().toString()); } - Map<String, Object> sliceProfileAn = bean2Map(anSliceTaskInfo.getSliceProfile()); - for (Map.Entry<String, Object> entry : sliceProfileAn.entrySet()) { - jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), entry.getValue().toString()); + String value = entry.getValue() == null ? "" : entry.getValue().toString(); + jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), value); } - Map<String, Object> sliceProfileCn = bean2Map(cnSliceTaskInfo.getSliceProfile()); for (Map.Entry<String, Object> entry : sliceProfileCn.entrySet()) { - jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), entry.getValue().toString()); + String value = entry.getValue() == null ? "" : entry.getValue().toString(); + jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), value); } - Map<String, Object> sliceProfileTnBH = bean2Map(tnBHSliceTaskInfo.getSliceProfile()); for (Map.Entry<String, Object> entry : sliceProfileTnBH.entrySet()) { - jsonObject.addProperty("SliceProfile.TN.BH." + entry.getKey(), entry.getValue().toString()); + String value = entry.getValue() == null ? "" : entry.getValue().toString(); + jsonObject.addProperty("SliceProfile.TN.BH." + entry.getKey(), value); } - Map<String, Object> sliceProfileTnMH = bean2Map(tnMHSliceTaskInfo.getSliceProfile()); for (Map.Entry<String, Object> entry : sliceProfileTnMH.entrySet()) { - jsonObject.addProperty("SliceProfile.TN.MH." + entry.getKey(), entry.getValue().toString()); + String value = entry.getValue() == null ? "" : entry.getValue().toString(); + jsonObject.addProperty("SliceProfile.TN.MH." + entry.getKey(), value); } - Map<String, Object> sliceProfileTnFH = bean2Map(tnFHSliceTaskInfo.getSliceProfile()); for (Map.Entry<String, Object> entry : sliceProfileTnFH.entrySet()) { - jsonObject.addProperty("SliceProfile.TN.FH." + entry.getKey(), entry.getValue().toString()); + String value = entry.getValue() == null ? "" : entry.getValue().toString(); + jsonObject.addProperty("SliceProfile.TN.FH." + entry.getKey(), value); } - jsonObject.addProperty("TN.BH.SuggestNSSIId", tnBHSliceTaskInfo.getSuggestNssiId()); jsonObject.addProperty("TN.BH.SuggestNSSIName", tnBHSliceTaskInfo.getSuggestNssiName()); jsonObject.addProperty("TN.BH.progress", tnBHSliceTaskInfo.getProgress()); @@ -182,7 +181,6 @@ public class SliceTaskParamsAdapter implements Serializable { jsonObject.addProperty("TN.BH.statusDescription", tnBHSliceTaskInfo.getStatusDescription()); jsonObject.addProperty("TN.BH.ScriptName", tnBHSliceTaskInfo.getScriptName()); - jsonObject.addProperty("TN.MH.SuggestNSSIId", tnMHSliceTaskInfo.getSuggestNssiId()); jsonObject.addProperty("TN.MH.SuggestNSSIName", tnMHSliceTaskInfo.getSuggestNssiName()); jsonObject.addProperty("TN.MH.progress", tnMHSliceTaskInfo.getProgress()); @@ -190,7 +188,6 @@ public class SliceTaskParamsAdapter implements Serializable { jsonObject.addProperty("TN.MH.statusDescription", tnMHSliceTaskInfo.getStatusDescription()); jsonObject.addProperty("TN.MH.ScriptName", tnMHSliceTaskInfo.getScriptName()); - jsonObject.addProperty("TN.FH.SuggestNSSIId", tnFHSliceTaskInfo.getSuggestNssiId()); jsonObject.addProperty("TN.FH.SuggestNSSIName", tnFHSliceTaskInfo.getSuggestNssiName()); jsonObject.addProperty("TN.FH.progress", tnFHSliceTaskInfo.getProgress()); @@ -198,7 +195,6 @@ public class SliceTaskParamsAdapter implements Serializable { jsonObject.addProperty("TN.FH.statusDescription", tnFHSliceTaskInfo.getStatusDescription()); jsonObject.addProperty("TN.FH.ScriptName", tnFHSliceTaskInfo.getScriptName()); - jsonObject.addProperty("CN.SuggestNSSIId", cnSliceTaskInfo.getSuggestNssiId()); jsonObject.addProperty("CN.SuggestNSSIName", cnSliceTaskInfo.getSuggestNssiName()); jsonObject.addProperty("CN.progress", cnSliceTaskInfo.getProgress()); @@ -206,7 +202,6 @@ public class SliceTaskParamsAdapter implements Serializable { jsonObject.addProperty("CN.statusDescription", cnSliceTaskInfo.getStatusDescription()); jsonObject.addProperty("CN.ScriptName", cnSliceTaskInfo.getScriptName()); - jsonObject.addProperty("AN.SuggestNSSIId", anSliceTaskInfo.getSuggestNssiId()); jsonObject.addProperty("AN.SuggestNSSIName", anSliceTaskInfo.getSuggestNssiName()); jsonObject.addProperty("AN.progress", anSliceTaskInfo.getProgress()); @@ -219,7 +214,7 @@ public class SliceTaskParamsAdapter implements Serializable { /** * change T t to {@link Map} - * + * * @param t input * @param <T> Object * @return {@link Map} @@ -234,9 +229,18 @@ public class SliceTaskParamsAdapter implements Serializable { Field[] fields = t.getClass().getDeclaredFields(); for (Field field : fields) { String name = field.getName(); - Method method = t.getClass().getMethod("get" + name); + String key = name; + if (name == null || "".equals(name) || "serialVersionUID".equalsIgnoreCase(name)) { + continue; + } + JsonProperty annotation = field.getAnnotation(JsonProperty.class); + if (annotation != null && !annotation.value().equals(JsonProperty.USE_DEFAULT_NAME)) { + key = annotation.value(); + } + + Method method = t.getClass().getMethod("get" + name.substring(0, 1).toUpperCase() + name.substring(1)); Object value = method.invoke(t); - resMap.put(name, value); + resMap.put(key, value); } } catch (Exception e) { @@ -247,7 +251,7 @@ public class SliceTaskParamsAdapter implements Serializable { /** * replace of slice profile - * + * * @param paramMap params map * @param header starts of key * @return Map diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java index ccd6001957..3f0da1bf21 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java @@ -21,16 +21,28 @@ package org.onap.so.beans.nsmf; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; +import java.io.Serializable; +import java.util.List; @JsonInclude(JsonInclude.Include.NON_NULL) @Data -public class TnSliceProfile { +public class TnSliceProfile implements Serializable { + + private static final long serialVersionUID = 3767943556195823439L; private String sliceProfileId; + @JsonProperty(value = "maxBandwidth") private String bandwidth; @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; } |