From 36393afecf62cf530208297c64a3ea17fc6d5b7c Mon Sep 17 00:00:00 2001 From: "sunil.n" Date: Mon, 10 Nov 2025 18:17:55 +0530 Subject: [PATCH] Implement 3GPP 28.532 Modify NetworkSliceSubnet API. It's implemented for demo purpose only. Function logs request and sends OK response Change-Id: I5d5d003f8bba938639cd7e48f8dcee4e5528496b Signed-off-by: sunil.n --- .../rapp-ran-nssmf-simulator/README.md | 50 ++++++++++++++++++++-- .../controller/NetworkSliceSubnetController.java | 26 +++++++++++ .../ran/nssmf/simulator/dto/SliceProfileDTO.java | 9 ++++ 3 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/dto/SliceProfileDTO.java diff --git a/sample-rapp-generator/rapp-ran-nssmf-simulator/README.md b/sample-rapp-generator/rapp-ran-nssmf-simulator/README.md index 0b808e1..a7be21c 100644 --- a/sample-rapp-generator/rapp-ran-nssmf-simulator/README.md +++ b/sample-rapp-generator/rapp-ran-nssmf-simulator/README.md @@ -6,11 +6,17 @@ ### Network Slice Subnet Management API -#### Endpoint +#### Get Network Slice Subnet - **URL**: `http://localhost:8080/3GPPManagement/ProvMnS/v17.0.0/NetworkSliceSubnets/{subnetId}` - **Method**: `GET` - **Content-Type**: `application/json` +#### Modify Network Slice Subnet +- **URL**: `http://localhost:8080/3GPPManagement/ProvMnS/v17.0.0/NetworkSliceSubnets/{subnetId}` +- **Method**: `PUT` +- **Content-Type**: `application/json` +- **Request Body**: NetworkSliceSubnetDTO with updated slice profile characteristics + #### Supported Subnet IDs The simulator supports 6 pre-configured network slice subnets with different characteristics: @@ -67,16 +73,49 @@ The simulator supports 6 pre-configured network slice subnets with different cha #### Example Usage -**cURL Command:** +**cURL Command (GET):** ```bash curl -X GET \ http://localhost:8080/3GPPManagement/ProvMnS/v17.0.0/NetworkSliceSubnets/9090d36f-6af5-4cfd-8bda-7a3c88fa82fa \ -H 'Content-Type: application/json' ``` +**cURL Command (PUT):** +```bash +curl -X PUT \ + http://localhost:8080/3GPPManagement/ProvMnS/v17.0.0/NetworkSliceSubnets/9090d36f-6af5-4cfd-8bda-7a3c88fa82fa \ + -H 'Content-Type: application/json' \ + -d '{ + "id": "9090d36f-6af5-4cfd-8bda-7a3c88fa82fa", + "attributes": { + "operationalState": "enabled", + "administrativeState": "UNLOCKED", + "networkSliceSubnetType": "RAN_SLICESUBNET", + "sliceProfileList": [ + { + "sliceProfileId": "2f1ca17d-5c44-4355-bfed-e9800a2996c1", + "pLMNInfoList": [ + { + "PLMNId": { + "mcc": "330", + "mnc": "220" + }, + "SNSSAI": { + "sst": 1, + "sd": "000001" + } + } + ] + } + ] + } + }' +``` + **Response Codes:** -- `200 OK`: Successfully retrieved network slice subnet +- `200 OK`: Successfully retrieved or modified network slice subnet - `404 Not Found`: Subnet ID not found +- `400 Bad Request`: Invalid request body or validation errors #### Key Features - **3GPP Compliance**: Implements 3GPP 28.532 Network Slice Subnet Management @@ -225,6 +264,7 @@ The simulator automatically sends file ready notifications to all subscribed end ### Network Slice Subnet DTOs - **NetworkSliceSubnetDTO**: Main network slice subnet representation with ID and attributes - **NetworkSliceSubnetAttributesDTO**: Slice subnet attributes including operational state, administrative state, and slice profiles +- **SliceProfileDTO**: Response DTO for slice profile modification operations (placeholder for 3GPP TS28541_SliceNrm.yaml compliance) - **SliceProfileItemDTO**: Individual slice profile configuration with PLMN info and RAN profile - **SliceProfileExtensionsDTO**: Slice profile extensions including service state - **PlmnInfoListDTO**: PLMN information list containing network identifiers @@ -252,11 +292,13 @@ The simulator automatically sends file ready notifications to all subscribed end ### Key Components - **FileDataReportingMnSController**: REST controller handling subscriptions and notifications -- **NetworkSliceSubnetController**: REST controller handling network slice subnet management operations +- **NetworkSliceSubnetController**: REST controller handling network slice subnet management operations (GET and PUT) +- **Request Validation**: Jakarta validation annotations for input validation on modification requests - **Scheduled Notifications**: Automated file ready notifications every 5 minutes - **RestTemplate**: HTTP client for sending callback notifications - **In-memory Storage**: HashMap-based subscription management - **Pre-configured Slice Data**: Mock network slice subnet configurations for testing +- **Comprehensive Logging**: Detailed logging for all operations including modification requests ## Directory Structure diff --git a/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/controller/NetworkSliceSubnetController.java b/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/controller/NetworkSliceSubnetController.java index 1fb9cc7..c9d2874 100644 --- a/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/controller/NetworkSliceSubnetController.java +++ b/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/controller/NetworkSliceSubnetController.java @@ -2,12 +2,17 @@ package org.oransc.ran.nssmf.simulator.controller; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; + +import jakarta.validation.Valid; + import org.oransc.ran.nssmf.simulator.dto.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -118,4 +123,25 @@ public class NetworkSliceSubnetController { return ResponseEntity.ok(responseDto); } + + /** + * Modifies an existing Network Slice Subnet with the provided profile. + * + * @param subnetId The unique identifier of the Network Slice Subnet to be modified. + * @param updatedSliceProfile The DTO containing the updated characteristics for the Network Slice Subnet. + * @return A ResponseEntity with HTTP status 200 (OK) and the updated profile, + * or 204 (No Content) if no content is returned on success. + */ + @PutMapping("/NetworkSliceSubnets/{subnetId}") + public ResponseEntity modifyNetworkSliceSubnet(@PathVariable String subnetId, @Valid @RequestBody NetworkSliceSubnetDTO updatedSliceProfile) { + try { + String updatedSliceProfileJson = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(updatedSliceProfile); + logger.info("Modification request received for subnetId: {} with data:\\n {}", subnetId, updatedSliceProfileJson); + } catch (Exception e) { + logger.error("Error converting updatedSliceProfile to JSON: {}", e.getMessage()); + } + // Assume modification is successful and return the updated profile (placeholder) + SliceProfileDTO updatedProfile = new SliceProfileDTO(); // In a real scenario, this would be populated + return ResponseEntity.ok(updatedProfile); + } } diff --git a/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/dto/SliceProfileDTO.java b/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/dto/SliceProfileDTO.java new file mode 100644 index 0000000..fdc532c --- /dev/null +++ b/sample-rapp-generator/rapp-ran-nssmf-simulator/ran-nssmf-simulator/src/main/java/org/oransc/ran/nssmf/simulator/dto/SliceProfileDTO.java @@ -0,0 +1,9 @@ +package org.oransc.ran.nssmf.simulator.dto; + +import lombok.Data; + +@Data +public class SliceProfileDTO { + // Fields based on SliceProfile from TS28541_SliceNrm.yaml + // This is a placeholder for the response body of the modify operation. +} -- 2.16.6