2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.beans.nsmf;
23 import com.fasterxml.jackson.annotation.JsonProperty;
25 import lombok.ToString;
26 import org.springframework.beans.BeanUtils;
27 import java.io.Serializable;
28 import java.util.Arrays;
32 public class SliceProfileAdapter implements Serializable {
34 private static final long serialVersionUID = -6412175980642584804L;
36 @JsonProperty(value = "sliceProfileId")
37 private String sliceProfileId;
39 @JsonProperty(value = "sNSSAI")
40 private String sNSSAIList = "";
42 @JsonProperty(value = "pLMNIdList")
43 private String pLMNIdList = "";
45 @JsonProperty(value = "maxNumberofUEs")
46 private long maxNumberofUEs;
48 @JsonProperty(value = "coverageAreaTAList")
49 private String coverageAreaTAList = "";
51 @JsonProperty(value = "latency")
54 @JsonProperty(value = "uEMobilityLevel")
55 private String uEMobilityLevel;
57 @JsonProperty(value = "resourceSharingLevel")
58 private String resourceSharingLevel;
60 @JsonProperty(value = "maxBandwidth")
61 private String bandwidth;
63 @JsonProperty(value = "sST")
66 @JsonProperty(value = "activityFactor")
67 private String activityFactor;
69 @JsonProperty(value = "survivalTime")
70 private String survivalTime;
72 public AnSliceProfile trans2AnProfile() {
73 AnSliceProfile anSliceProfile = new AnSliceProfile();
74 BeanUtils.copyProperties(this, anSliceProfile);
75 anSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|")));
76 anSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
78 String[] areas = this.coverageAreaTAList.split("\\|");
79 Integer[] areasRes = new Integer[areas.length];
80 for (int i = 0; i < areas.length; i++) {
81 areasRes[i] = str2Code(areas[i]);
83 anSliceProfile.setCoverageAreaTAList(Arrays.asList(areasRes));
84 anSliceProfile.setUEMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel));
85 anSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
86 PerfReq perfReq = new PerfReq();
88 anSliceProfile.setPerfReq(perfReq);
89 return anSliceProfile;
92 private Integer str2Code(String area) {
93 return area.hashCode() >> 16;
96 public CnSliceProfile trans2CnProfile() {
97 CnSliceProfile cnSliceProfile = new CnSliceProfile();
98 BeanUtils.copyProperties(this, cnSliceProfile);
99 cnSliceProfile.setSnssaiList(Arrays.asList(this.sNSSAIList.split("\\|")));
100 cnSliceProfile.setCoverageAreaTAList(Arrays.asList(this.coverageAreaTAList.split("\\|")));
101 cnSliceProfile.setPlmnIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
102 cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
103 PerfReq perfReq = new PerfReq();
105 cnSliceProfile.setPerfReq(perfReq);
106 return cnSliceProfile;
109 public TnSliceProfile trans2TnProfile() {
110 TnSliceProfile tnSliceProfile = new TnSliceProfile();
111 BeanUtils.copyProperties(this, tnSliceProfile);
112 tnSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|")));
113 tnSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
114 return tnSliceProfile;