### 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:
#### 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
### 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
### 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
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;
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<SliceProfileDTO> 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);
+ }
}