1 package org.oransc.ran.nssmf.simulator.controller;
3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.fasterxml.jackson.databind.SerializationFeature;
5 import org.oransc.ran.nssmf.simulator.dto.*;
6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory;
8 import org.springframework.http.ResponseEntity;
9 import org.springframework.web.bind.annotation.GetMapping;
10 import org.springframework.web.bind.annotation.PathVariable;
11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RestController;
14 import java.util.Arrays;
15 import java.util.List;
19 @RequestMapping("/3GPPManagement/ProvMnS/${mns.fileDataReporting.version}") // Example version
20 public class NetworkSliceSubnetController {
22 private static final Logger logger = LoggerFactory.getLogger(NetworkSliceSubnetController.class);
24 private static final ObjectMapper objectMapper;
27 objectMapper = new ObjectMapper();
28 objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
32 * Retrieves an existing Network Slice Subnet by its ID.
34 * @param subnetId The unique identifier of the Network Slice Subnet to be retrieved.
35 * @return A ResponseEntity with HTTP status 200 (OK) and the NetworkSliceSubnetDTO,
36 * or 404 (Not Found) if no such subnet exists.
38 @GetMapping("/NetworkSliceSubnets/{subnetId}")
39 public ResponseEntity<NetworkSliceSubnetDTO> getNetworkSliceSubnet(@PathVariable String subnetId) {
40 logger.info("Get request received for subnetId: {}", subnetId);
41 NetworkSliceSubnetDTO responseDto = new NetworkSliceSubnetDTO();
42 responseDto.setId(subnetId);
44 NetworkSliceSubnetAttributesDTO attributes = new NetworkSliceSubnetAttributesDTO();
45 attributes.setOperationalState("enabled");
46 attributes.setAdministrativeState("UNLOCKED");
47 attributes.setNetworkSliceSubnetType("RAN_SLICESUBNET");
48 attributes.setManagedFunctionRef(Arrays.asList(
49 "2c000978-15e3-4393-984e-a20d32c96004-AUPF_200000",
50 "2c000978-15e3-4393-984e-a20d32c96004-DU_200000",
51 "2c000978-15e3-4393-984e-a20d32c96004-ACPF_200000"
53 attributes.setNetworkSliceSubnetRef(List.of());
55 SliceProfileItemDTO sliceProfileItem = new SliceProfileItemDTO();
56 SliceProfileExtensionsDTO extensions = new SliceProfileExtensionsDTO();
57 extensions.setState("IN_SERVICE");
58 sliceProfileItem.setExtensions(extensions);
60 PlmnInfoListDTO plmnInfo = new PlmnInfoListDTO();
61 PlmnIdDTO plmnId = new PlmnIdDTO();
64 plmnInfo.setPLMNId(plmnId);
66 SnssaiDTO snssai = new SnssaiDTO();
67 plmnInfo.setSNSSAI(snssai);
68 sliceProfileItem.setPLMNInfoList(List.of(plmnInfo));
70 RanSliceSubnetProfileDTO ranProfile = new RanSliceSubnetProfileDTO();
71 ranProfile.setCoverageAreaTAList(Arrays.asList(1, 2));
72 ranProfile.setResourceSharingLevel("shared");
75 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82fa":
76 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c1");
78 snssai.setSd("000001");
80 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82fb":
81 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c2");
83 snssai.setSd("000002");
84 ranProfile.setRRU_PrbDl(1024);
85 ranProfile.setRRU_PrbUl(3096);
87 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82fc":
88 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c3");
90 snssai.setSd("000003");
92 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82fd":
93 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c4");
95 snssai.setSd("000004");
96 ranProfile.setRRU_PrbDl(256);
97 ranProfile.setRRU_PrbUl(512);
99 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82fe":
100 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c5");
102 snssai.setSd("000005");
104 case "9090d36f-6af5-4cfd-8bda-7a3c88fa82ff":
105 sliceProfileItem.setSliceProfileId("2f1ca17d-5c44-4355-bfed-e9800a2996c6");
107 snssai.setSd("000006");
108 ranProfile.setRRU_PrbDl(2048);
109 ranProfile.setRRU_PrbUl(4096);
112 return ResponseEntity.notFound().build();
115 sliceProfileItem.setRANSliceSubnetProfile(ranProfile);
116 attributes.setSliceProfileList(List.of(sliceProfileItem));
117 responseDto.setAttributes(attributes);
119 return ResponseEntity.ok(responseDto);