Commit 2fd14074 authored by Christos Tranoris's avatar Christos Tranoris
Browse files

fix parsing

parent 1ff3a05a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -4,10 +4,11 @@ import org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle.SlePolicy;
import org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle.SliceTemplateRef;
import org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle.SloPolicy;
import org.etsi.osl.controllers.ietf.ns.domain.common.ExcludeFromMapping;
import org.etsi.osl.controllers.ietf.ns.domain.common.LogicalResourceMappable;
import org.etsi.osl.controllers.ietf.ns.domain.common.LogicalResourceSpecMappable;
import org.etsi.osl.controllers.ietf.ns.domain.common.RelatedManagedResourceReference;
import org.etsi.osl.tmf.ri639.model.LogicalResource;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Transient;
import lombok.AllArgsConstructor;
@@ -70,6 +71,7 @@ public class SloSleTemplate implements LogicalResourceSpecMappable, RelatedManag
     *
     * Mandatory containment (1..1 cardinality).
     */
    @JsonAlias({"slo-policy"})
    private SloPolicy sloPolicy;

    /**
@@ -82,6 +84,7 @@ public class SloSleTemplate implements LogicalResourceSpecMappable, RelatedManag
     *
     * Mandatory containment (1..1 cardinality).
     */
    @JsonAlias({"sle-policy"})
    private SlePolicy slePolicy;
    

@@ -138,16 +141,19 @@ public class SloSleTemplate implements LogicalResourceSpecMappable, RelatedManag
    }

    @Override
    @JsonIgnore
    public String getEntityId() {
      return this.id;
    }

    @Override
    @JsonIgnore
    public String getEntityName() {
      return this.id; //name is equal to id
      return this.id;
    }

    @Override
    @JsonIgnore
    public String getEntityDescription() {
      return this.description;
    }
+4 −0
Original line number Diff line number Diff line
package org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle;

import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -19,17 +20,20 @@ public class AvailabilityType {
     * Availability percentage (0.0 to 100.0)
     * Examples: 99.0, 99.9, 99.99, 99.999
     */
    @JsonAlias({"availability-percentage"})
    private Double availabilityPercentage;

    /**
     * Commitment period for the availability SLO
     * Examples: "per-month", "per-year", "per-service-life"
     */
    @JsonAlias({"commitment-period"})
    private String commitmentPeriod;

    /**
     * Downtime allowed per period in minutes
     * Calculated as (100 - availabilityPercentage) * periodLength
     */
    @JsonAlias({"allowed-downtime-minutes"})
    private Long allowedDowntimeMinutes;
}
+5 −0
Original line number Diff line number Diff line
package org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle;

import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -26,6 +27,7 @@ public class MetricBound {
     * Type of SLO metric being bounded.
     * Examples: ONE_WAY_DELAY_MAXIMUM, TWO_WAY_BANDWIDTH, ONE_WAY_PACKET_LOSS
     */
    @JsonAlias({"metric-type"})
    private ServiceSloMetricType metricType;

    /**
@@ -37,6 +39,7 @@ public class MetricBound {
     * - For delay: "ms", "us", "ns"
     * - For loss: "%"
     */
    @JsonAlias({"metric-unit"})
    private String metricUnit;

    /**
@@ -44,6 +47,7 @@ public class MetricBound {
     * Useful for documenting the purpose and context of the metric.
     * Example: "Maximum one-way latency between customer sites"
     */
    @JsonAlias({"value-description"})
    private String valueDescription;

    /**
@@ -61,6 +65,7 @@ public class MetricBound {
     * - ONE_WAY_DELAY_VARIATION_PERCENTILE
     * - TWO_WAY_DELAY_VARIATION_PERCENTILE
     */
    @JsonAlias({"percentile-value"})
    private BigDecimal percentileValue;

    /**
+22 −11
Original line number Diff line number Diff line
package org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Enumeration of Service Level Expectation (SLE) isolation types.
 *
 * These types correspond to YANG identities in the
 * draft-ietf-teas-ietf-network-slice-nbi-yang-25 specification and
 * define isolation requirements that can be applied to network slice services.
 *
 * Isolation types ensure that network slices do not interfere with each other
 * and meet specific separation requirements such as:
 * - Physical path isolation
 * - Logical isolation
 * - Resource isolation
 * - Traffic isolation
 * Accepts both RFC 9543 kebab-case (e.g., "physical-isolation") and
 * UPPER_SNAKE_CASE (e.g., "PHYSICAL_ISOLATION") during deserialization.
 */
public enum ServiceIsolationType {
    PHYSICAL_ISOLATION,
@@ -20,5 +15,21 @@ public enum ServiceIsolationType {
    TRAFFIC_ISOLATION,
    RESOURCE_ISOLATION,
    DEDICATED_RESOURCES,
    SHARED_RESOURCES_LIMITED
    SHARED_RESOURCES_LIMITED;

    @JsonCreator
    public static ServiceIsolationType fromValue(String value) {
        if (value == null || value.isBlank()) return null;
        String normalized = value.toUpperCase().replace('-', '_');
        try {
            return ServiceIsolationType.valueOf(normalized);
        } catch (IllegalArgumentException e) {
            return null;
        }
    }

    @JsonValue
    public String toValue() {
        return name().toLowerCase().replace('_', '-');
    }
}
+22 −10
Original line number Diff line number Diff line
package org.etsi.osl.controllers.ietf.ns.api.domain.model.slo_sle;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Enumeration of Service Level Expectation (SLE) security types.
 *
 * These types correspond to YANG identities in the
 * draft-ietf-teas-ietf-network-slice-nbi-yang-25 specification and
 * define security requirements that can be applied to network slice services.
 *
 * Security types may include:
 * - Encryption requirements
 * - Authentication mechanisms
 * - Access control policies
 * - Data protection standards
 * Accepts both RFC 9543 kebab-case (e.g., "encryption-required") and
 * UPPER_SNAKE_CASE (e.g., "ENCRYPTION_REQUIRED") during deserialization.
 */
public enum ServiceSecurityType {
    ENCRYPTION_REQUIRED,
@@ -19,5 +15,21 @@ public enum ServiceSecurityType {
    INTEGRITY_PROTECTION,
    CONFIDENTIALITY_REQUIRED,
    SECURE_ROUTING,
    VPN_REQUIRED
    VPN_REQUIRED;

    @JsonCreator
    public static ServiceSecurityType fromValue(String value) {
        if (value == null || value.isBlank()) return null;
        String normalized = value.toUpperCase().replace('-', '_');
        try {
            return ServiceSecurityType.valueOf(normalized);
        } catch (IllegalArgumentException e) {
            return null;
        }
    }

    @JsonValue
    public String toValue() {
        return name().toLowerCase().replace('_', '-');
    }
}
Loading